blob: 1fe4fdb5b92446bc6e5333b88c24f42938593cdf [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
Alp Tokerd0847342014-06-09 23:59:38 +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
Alp Tokerd0847342014-06-09 23:59:38 +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//
Rafael Espindola33ebd212014-02-21 03:14:07 +000014// RUN: %clang_cc1 %s -S -o - -triple=i386-apple-darwin -verify -no-integrated-as
Quentin Colombet728c5542014-02-06 18:30:43 +000015
16extern void doIt(char *);
17
Alp Tokerfb8d02b2014-06-05 22:10:59 +000018// REGULAR: warning: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
19// PROMOTE: error: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
20// IGNORE-NOT: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
Quentin Colombet728c5542014-02-06 18:30:43 +000021void stackSizeWarning() {
22 char buffer[80];
23 doIt(buffer);
24}
25
26// ASM: inline assembly requires more registers than available
27void inlineAsmError(int x0, int x1, int x2, int x3, int x4,
28 int x5, int x6, int x7, int x8, int x9) {
29 __asm__("hello world": : "r" (x0),"r" (x1),"r" (x2),"r" (x3), // expected-error + {{inline assembly requires more registers than available}}
30 "r" (x4),"r" (x5),"r" (x6),"r" (x7),"r" (x8),"r" (x9));
31}