1 /* RUN: %clang_cc1 %s -std=c89 -pedantic -fsyntax-only -verify -Wimplicit-function-declaration
7 int j; /* expected-warning {{mixing declarations and code}} */
12 int j; /* expected-warning {{mixing declarations and code}} */
17 __extension__ int j; /* expected-warning {{mixing declarations and code}} */
21 long long test2; /* expected-warning {{extension}} */
25 int A[i]; /* expected-warning {{variable length array}} */
28 int test4 = 0LL; /* expected-warning {{long long}} */
35 int *__restrict; /* expected-error {{expected identifier}} */
38 /* Implicit int, always ok */
42 test7; /* expected-warning {{declaration specifier missing, defaulting to 'int'}} */
44 void test8(int, x); /* expected-warning {{declaration specifier missing, defaulting to 'int'}} */
47 int a(sometype, y) {return 0;} /* expected-warning {{declaration specifier missing, defaulting to 'int'}} \
48 expected-error {{parameter name omitted}}*/
54 void f11 (z) /* expected-error {{may not have 'void' type}} */
59 void foo(T); /* typedef for void is allowed */
64 void test10 (int x[*]); /* expected-warning {{variable length arrays are a C99 feature}} */
65 void test11 (int x[static 4]); /* expected-warning {{static array size is a C99 feature}} */
67 void test12 (int x[const 4]) { /* expected-warning {{qualifier in array size is a C99 feature}} */
68 int Y[x[1]]; /* expected-warning {{variable length arrays are a C99 feature}} */
77 int a = test13a().X[1]; /* expected-warning {{ISO C90 does not allow subscripting non-lvalue array}} */
78 int b = 1[test13a().X]; /* expected-warning {{ISO C90 does not allow subscripting non-lvalue array}} */
81 /* Make sure we allow *test14 as a "function designator" */
82 int test14() { return (&*test14)(); }
84 int test15[5] = { [2] = 1 }; /* expected-warning {{designated initializers are a C99 feature}} */
86 extern int printf(__const char *__restrict __format, ...);
88 /* Warn, but don't suggest typo correction. */
90 printg("Hello, world!\n"); /* expected-warning {{implicit declaration of function 'printg'}} */
93 struct x { int x,y[]; }; /* expected-warning {{Flexible array members are a C99-specific feature}} */
95 /* Duplicated type-qualifiers aren't allowed by C90 */
96 const const int c_i; /* expected-warning {{duplicate 'const' declaration specifier}} */
97 typedef volatile int vol_int;
98 volatile vol_int volvol_i; /* expected-warning {{duplicate 'volatile' declaration specifier}} */
99 typedef volatile vol_int volvol_int; /* expected-warning {{duplicate 'volatile' declaration specifier}} */
102 typedef const int CI;
104 const CI mine1[5][5]; /* expected-warning {{duplicate 'const' declaration specifier}} */
106 typedef CI array_of_CI[5];
107 const array_of_CI mine2; /* expected-warning {{duplicate 'const' declaration specifier}} */
109 typedef CI *array_of_pointer_to_CI[5];
110 const array_of_pointer_to_CI mine3;
112 void main() {} /* expected-error {{'main' must return 'int'}} */