Rebase.
[official-gcc.git] / gcc / testsuite / gcc.dg / c11-thread-local-1.c
blobb21209aecd15721c7ce86fb8f62566042d260c8e
1 /* Test for _Thread_local in C11. Test of valid code. */
2 /* { dg-do compile } */
3 /* { dg-options "-std=c11 -pedantic-errors" } */
5 _Thread_local int a;
6 static _Thread_local long b;
7 extern _Thread_local int c, a;
8 _Thread_local static int d;
9 long _Thread_local extern b;
10 _Thread_local int extern a;
11 _Thread_local struct s; /* { dg-warning "useless" } */
12 _Thread_local int a = 1;
13 extern _Thread_local int c = 2; /* { dg-warning "initialized and" } */
14 void
15 f (void)
17 static _Thread_local int x;
18 extern _Thread_local long b;
19 _Thread_local extern int a;
22 inline void
23 fi (void)
25 static _Thread_local const int v;
26 (void) a;
27 static _Thread_local int (*const p)[a];