blob: acb15f27d1aa8ff9f1ef3b818258f3c502784427 [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//
7// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -S -o - -triple=i386-apple-darwin 2> %t.err
8// RUN: FileCheck < %t.err %s --check-prefix=REGULAR --check-prefix=ASM
9// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -S -o - -triple=i386-apple-darwin -Werror=frame-larger-than 2> %t.err
10// RUN: FileCheck < %t.err %s --check-prefix=PROMOTE --check-prefix=ASM
11// RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -S -o - -triple=i386-apple-darwin -Wno-frame-larger-than 2> %t.err
12// 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.
17// RUN: %clang_cc1 %s -S -o - -triple=i386-apple-darwin -verify
18
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}