c89.c revision 8123a95c33b792d35c2e4992ba6e27882748fb0d
1/* RUN: clang %s -std=c89 -pedantic -fsyntax-only -verify 2 */ 3void test1() { 4 { 5 int i; 6 i = i + 1; 7 int j; /* expected-warning {{mixing declarations and code}} */ 8 } 9 { 10 __extension__ int i; 11 i = i + 1; 12 int j; /* expected-warning {{mixing declarations and code}} */ 13 } 14 { 15 int i; 16 i = i + 1; 17 __extension__ int j; /* expected-warning {{mixing declarations and code}} */ 18 } 19} 20 21long long test2; /* expected-warning {{extension}} */ 22 23 24void test3(int i) { 25 int A[i]; /* expected-warning {{variable length array}} */ 26} 27 28int test4 = 0LL; /* expected-warning {{long long}} */ 29 30/* PR1999 */ 31void test5(register); 32 33/* PR2041 */ 34int *restrict; 35int *__restrict; /* expected-error {{expected identifier}} */ 36 37 38/* Implicit int, always ok */ 39test6() {} 40 41/* PR2012 */ 42test7; /* expected-warning {{declaration specifier missing, defaulting to 'int'}} */ 43 44void test8(int, x); /* expected-warning {{declaration specifier missing, defaulting to 'int'}} */ 45 46typedef int sometype; 47int a(sometype, y) {return 0;} /* expected-warning {{declaration specifier missing, defaulting to 'int'}} */ 48 49 50 51 52void bar (void *); 53void f11 (z) /* expected-error {{may not have 'void' type}} */ 54void z; 55{ bar (&z); } 56 57typedef void T; 58void foo(T); /* expected-warning {{empty parameter list defined with a typedef of 'void' is a C99 feature}} */ 59 60