Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / warn-extern-main.c
blob7b73fe3473de59d3f900dc46e4c0ad416f63259f
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST1
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST2
3 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST3
4 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST4
5 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST5
6 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST6
7 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST7
8 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST8
9 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST9 -ffreestanding
11 #if TEST1
12 int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}}
14 #elif TEST2
15 extern int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}}
17 #elif TEST3
18 // expected-no-diagnostics
19 void x(void) {
20 static int main;
23 #elif TEST4
24 void x(void) {
25 extern int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}}
28 #elif TEST5
29 // expected-no-diagnostics
30 void x(void) {
31 int main;
34 #elif TEST6
35 // expected-no-diagnostics
36 static int main;
38 #elif TEST7
39 // expected-no-diagnostics
40 void x(void) {
41 auto int main;
44 #elif TEST8
45 // expected-no-diagnostics
46 void x(void) {
47 register int main;
50 #elif TEST9
51 // expected-no-diagnostics
52 int main;
54 #else
55 #error Unknown Test
56 #endif