Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / c11-thread-local-2.c
blob33872261689a9e782d577885c59cfab090d589af
1 /* Test for _Thread_local in C11. Test of invalid code. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
5 _Thread_local void f (void); /* { dg-error "storage class" } */
6 _Thread_local void g (void) {} /* { dg-error "_Thread_local" } */
7 typedef _Thread_local int t1; /* { dg-error "_Thread_local" } */
8 _Thread_local typedef int t2; /* { dg-error "_Thread_local" } */
10 void
11 h (void)
13 _Thread_local auto int a; /* { dg-error "_Thread_local" } */
14 _Thread_local register int b; /* { dg-error "_Thread_local" } */
15 auto _Thread_local int c; /* { dg-error "_Thread_local" } */
16 register _Thread_local int d; /* { dg-error "_Thread_local" } */
17 _Thread_local int e; /* { dg-error "_Thread_local" } */
20 _Thread_local int v; /* { dg-message "previous" } */
21 extern int v; /* { dg-error "thread" } */
22 int w; /* { dg-message "previous" } */
23 extern _Thread_local int w; /* { dg-error "thread" } */
25 _Thread_local int x; /* { dg-message "previous" } */
26 int y; /* { dg-message "previous" } */
28 int vv;
30 void
31 i (void)
33 extern int x; /* { dg-error "thread" } */
34 extern _Thread_local int y; /* { dg-error "thread" } */
35 static _Thread_local int a[vv]; /* { dg-error "storage size" } */
36 static _Thread_local int vi = vv; /* { dg-error "not constant" } */
39 static _Thread_local int sv;
41 inline void
42 j (void)
44 static _Thread_local int vj; /* { dg-error "static but declared" } */
45 (void) sv; /* { dg-error "static but used in inline" } */