blob: 8b61c0350eca2e45cfd39fefb5a8ce2ec7316b89 [file] [log] [blame]
Quentin Colombet728c5542014-02-06 18:30:43 +00001// REQUIRES: x86-registered-target
2// Play around with backend reporting:
3// _REGULAR_: Regular behavior, no warning switch enabled.
4// _PROMOTE_: Promote warning to error.
5// _IGNORE_: Drop backend warning.
6//
Rafael Espindola33ebd212014-02-21 03:14:07 +00007// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin 2> %t.err
Quentin Colombet728c5542014-02-06 18:30:43 +00008// RUN: FileCheck < %t.err %s --check-prefix=REGULAR --check-prefix=ASM
Rafael Espindola33ebd212014-02-21 03:14:07 +00009// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin -Werror=frame-larger-than 2> %t.err
Quentin Colombet728c5542014-02-06 18:30:43 +000010// RUN: FileCheck < %t.err %s --check-prefix=PROMOTE --check-prefix=ASM
Rafael Espindola33ebd212014-02-21 03:14:07 +000011// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin -Wno-frame-larger-than 2> %t.err
Quentin Colombet728c5542014-02-06 18:30:43 +000012// RUN: FileCheck < %t.err %s --check-prefix=IGNORE --check-prefix=ASM
13//
14// Currently the stack size reporting cannot be checked with -verify because
15// no source location is attached to the diagnostic. Therefore do not emit
16// them for the -verify test for now.
Rafael Espindola33ebd212014-02-21 03:14:07 +000017// RUN: %clang_cc1 %s -S -o - -triple=i386-apple-darwin -verify -no-integrated-as
Quentin Colombet728c5542014-02-06 18:30:43 +000018
19extern void doIt(char *);
20
21// REGULAR: warning: stack size exceeded ({{[0-9]+}}) in stackSizeWarning
22// PROMOTE: error: stack size exceeded ({{[0-9]+}}) in stackSizeWarning
23// IGNORE-NOT: stack size exceeded ({{[0-9]+}}) in stackSizeWarning
24void stackSizeWarning() {
25 char buffer[80];
26 doIt(buffer);
27}
28
29// ASM: inline assembly requires more registers than available
30void inlineAsmError(int x0, int x1, int x2, int x3, int x4,
31 int x5, int x6, int x7, int x8, int x9) {
32 __asm__("hello world": : "r" (x0),"r" (x1),"r" (x2),"r" (x3), // expected-error + {{inline assembly requires more registers than available}}
33 "r" (x4),"r" (x5),"r" (x6),"r" (x7),"r" (x8),"r" (x9));
34}