xref: /llvm-project/clang/test/Parser/gcc-for-loop-init-compatibility.c (revision 7deaeb2a056c1756ce6f2550d2ebb91b81b9ff29)
1 // RUN: %clang_cc1 -std=c89 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -std=gnu89 -fsyntax-only -verify %s
3 // RUN: %clang_cc1 -std=c99 -fsyntax-only -verify %s -DC99
4 
5 #ifdef C99
6 // expected-no-diagnostics
7 #endif
8 
foo(void)9 void foo(void) {
10 #ifndef C99
11   // expected-warning@+2{{GCC does not allow variable declarations in for loop initializers before C99}}
12 #endif
13   for (int i = 0; i < 10; i++)
14     ;
15 }
16