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 10 11 #if TEST1 12 int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}} 13 14 #elif TEST2 15 extern int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}} 16 17 #elif TEST3 18 // expected-no-diagnostics 19 void x() { 20 static int main; 21 } 22 23 #elif TEST4 24 void x() { 25 extern int main; // expected-warning{{variable named 'main' with external linkage has undefined behavior}} 26 } 27 28 #elif TEST5 29 // expected-no-diagnostics 30 void x() { 31 int main; 32 } 33 34 #elif TEST6 35 // expected-no-diagnostics 36 static int main; 37 38 #elif TEST7 39 // expected-no-diagnostics 40 void x() { 41 auto int main; 42 } 43 44 #elif TEST8 45 // expected-no-diagnostics 46 void x() { 47 register int main; 48 } 49 50 #elif TEST9 51 // expected-no-diagnostics 52 int main; 53 54 #else 55 #error Unknown Test 56 #endif 57