xref: /minix3/external/bsd/llvm/dist/clang/test/Frontend/backend-diagnostic.c (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // REQUIRES: x86-registered-target
2*0a6a1f1dSLionel Sambuc // Play around with backend reporting:
3*0a6a1f1dSLionel Sambuc // _REGULAR_: Regular behavior, no warning switch enabled.
4*0a6a1f1dSLionel Sambuc // _PROMOTE_: Promote warning to error.
5*0a6a1f1dSLionel Sambuc // _IGNORE_: Drop backend warning.
6*0a6a1f1dSLionel Sambuc //
7*0a6a1f1dSLionel Sambuc // RUN: not %clang_cc1 %s -mllvm -warn-stack-size=0 -no-integrated-as -S -o - -triple=i386-apple-darwin 2> %t.err
8*0a6a1f1dSLionel Sambuc // RUN: FileCheck < %t.err %s --check-prefix=REGULAR --check-prefix=ASM
9*0a6a1f1dSLionel Sambuc // 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
10*0a6a1f1dSLionel Sambuc // RUN: FileCheck < %t.err %s --check-prefix=PROMOTE --check-prefix=ASM
11*0a6a1f1dSLionel Sambuc // 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
12*0a6a1f1dSLionel Sambuc // RUN: FileCheck < %t.err %s --check-prefix=IGNORE --check-prefix=ASM
13*0a6a1f1dSLionel Sambuc //
14*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 %s -S -o - -triple=i386-apple-darwin -verify -no-integrated-as
15*0a6a1f1dSLionel Sambuc 
16*0a6a1f1dSLionel Sambuc extern void doIt(char *);
17*0a6a1f1dSLionel Sambuc 
18*0a6a1f1dSLionel Sambuc // REGULAR: warning: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
19*0a6a1f1dSLionel Sambuc // PROMOTE: error: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
20*0a6a1f1dSLionel Sambuc // IGNORE-NOT: stack frame size of {{[0-9]+}} bytes in function 'stackSizeWarning'
stackSizeWarning()21*0a6a1f1dSLionel Sambuc void stackSizeWarning() {
22*0a6a1f1dSLionel Sambuc   char buffer[80];
23*0a6a1f1dSLionel Sambuc   doIt(buffer);
24*0a6a1f1dSLionel Sambuc }
25*0a6a1f1dSLionel Sambuc 
26*0a6a1f1dSLionel Sambuc // ASM: inline assembly requires more registers than available
inlineAsmError(int x0,int x1,int x2,int x3,int x4,int x5,int x6,int x7,int x8,int x9)27*0a6a1f1dSLionel Sambuc void inlineAsmError(int x0, int x1, int x2, int x3, int x4,
28*0a6a1f1dSLionel Sambuc                     int x5, int x6, int x7, int x8, int x9) {
29*0a6a1f1dSLionel Sambuc   __asm__("hello world": : "r" (x0),"r" (x1),"r" (x2),"r" (x3), // expected-error + {{inline assembly requires more registers than available}}
30*0a6a1f1dSLionel Sambuc           "r" (x4),"r" (x5),"r" (x6),"r" (x7),"r" (x8),"r" (x9));
31*0a6a1f1dSLionel Sambuc }
32