Quentin Colombet | 728c554 | 2014-02-06 18:30:43 +0000 | [diff] [blame] | 1 | // 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 Espindola | 33ebd21 | 2014-02-21 03:14:07 +0000 | [diff] [blame^] | 7 | // RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin 2> %t.err |
Quentin Colombet | 728c554 | 2014-02-06 18:30:43 +0000 | [diff] [blame] | 8 | // RUN: FileCheck < %t.err %s --check-prefix=REGULAR --check-prefix=ASM |
Rafael Espindola | 33ebd21 | 2014-02-21 03:14:07 +0000 | [diff] [blame^] | 9 | // 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 Colombet | 728c554 | 2014-02-06 18:30:43 +0000 | [diff] [blame] | 10 | // RUN: FileCheck < %t.err %s --check-prefix=PROMOTE --check-prefix=ASM |
Rafael Espindola | 33ebd21 | 2014-02-21 03:14:07 +0000 | [diff] [blame^] | 11 | // 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 Colombet | 728c554 | 2014-02-06 18:30:43 +0000 | [diff] [blame] | 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. |
Rafael Espindola | 33ebd21 | 2014-02-21 03:14:07 +0000 | [diff] [blame^] | 17 | // RUN: %clang_cc1 %s -S -o - -triple=i386-apple-darwin -verify -no-integrated-as |
Quentin Colombet | 728c554 | 2014-02-06 18:30:43 +0000 | [diff] [blame] | 18 | |
| 19 | extern 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 |
| 24 | void stackSizeWarning() { |
| 25 | char buffer[80]; |
| 26 | doIt(buffer); |
| 27 | } |
| 28 | |
| 29 | // ASM: inline assembly requires more registers than available |
| 30 | void 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 | } |