Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / gnu2x-attrs-2.c
blobd512b2a2aca2fa8cf9b986d20a76a35600b20e00
1 /* Test C2x attribute syntax. Test GNU attributes appertain to
2 appropriate constructs. Attributes on types not being defined at
3 the time. */
4 /* { dg-do compile } */
5 /* { dg-options "-std=gnu2x -Wformat" } */
7 typedef void va_type (const char *, ...);
8 typedef va_type [[gnu::format (printf, 1, 2)]] printf_like_1;
9 typedef void printf_like_2 (const char *, ...) [[gnu::format (printf, 1, 2)]];
10 typedef __typeof__ (void (const char *, ...) [[gnu::format (printf, 1, 2)]])
11 printf_like_3;
13 va_type func1;
14 printf_like_1 func2;
15 printf_like_2 func3;
16 printf_like_3 func4;
17 va_type [[gnu::format (printf, 1, 2)]] *func5 (void);
19 void
20 func_test (void)
22 func1 ("%s", 1);
23 func2 ("%s", 1); /* { dg-warning "expects argument" } */
24 func3 ("%s", 1); /* { dg-warning "expects argument" } */
25 func4 ("%s", 1); /* { dg-warning "expects argument" } */
26 func5 () ("%s", 1); /* { dg-warning "expects argument" } */
29 typedef int A[2];
31 __typeof__ (int [[gnu::deprecated]]) var1; /* { dg-warning "deprecated" } */
32 __typeof__ (A [[gnu::deprecated]]) var2; /* { dg-warning "deprecated" } */
33 __typeof__ (int [3] [[gnu::deprecated]]) var3; /* { dg-warning "deprecated" } */