libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / c23-fordecl-3.c
blob03849fb5589b7926df289356618dc80c0393a05c
1 /* Test for C99 declarations in for loops. Test constraints are diagnosed with
2 -Wc11-c23-compat for C23. Based on c99-fordecl-2.c. */
3 /* { dg-do compile } */
4 /* { dg-options "-std=c23 -pedantic-errors -Wc11-c23-compat" } */
6 void
7 foo (void)
9 int j = 0;
10 for (int i = 1, bar (void); i <= 10; i++) /* { dg-warning "bar" } */
11 j += i;
13 for (static int i = 1; i <= 10; i++) /* /* { dg-warning "static" } */
14 j += i;
16 for (extern int i; j <= 500; j++) /* { dg-warning "extern" } */
17 j += 5;
19 for (enum { FOO } i = FOO; i < 10; i++) /* { dg-warning "FOO" } */
20 j += i;
22 for (enum BAR { FOO } i = FOO; i < 10; i++) /* { dg-warning "FOO" } */
23 /* { dg-warning "BAR" "enum tag in for loop" { target *-*-* } .-1 } */
24 j += i;
25 for (typedef int T;;) /* { dg-warning "non-variable" } */