summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c11-thread-local-2.c
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@baserock.org>2014-10-30 09:35:42 +0000
committer <>2015-01-09 11:51:27 +0000
commitc27a97d04853380f1e80525391b3f0d156ed4c84 (patch)
tree68ffaade7c605bc80cffa18360799c98a810976f /gcc/testsuite/gcc.dg/c11-thread-local-2.c
parent6af3fdec2262dd94954acc5e426ef71cbd4521d3 (diff)
downloadgcc-tarball-c27a97d04853380f1e80525391b3f0d156ed4c84.tar.gz
Imported from /home/lorry/working-area/delta_gcc-tarball/gcc-4.9.2.tar.bz2.gcc-4.9.2
Diffstat (limited to 'gcc/testsuite/gcc.dg/c11-thread-local-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/c11-thread-local-2.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/c11-thread-local-2.c b/gcc/testsuite/gcc.dg/c11-thread-local-2.c
new file mode 100644
index 0000000000..3387226168
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/c11-thread-local-2.c
@@ -0,0 +1,46 @@
+/* Test for _Thread_local in C11. Test of invalid code. */
+/* { dg-do compile } */
+/* { dg-options "-std=c11 -pedantic-errors" } */
+
+_Thread_local void f (void); /* { dg-error "storage class" } */
+_Thread_local void g (void) {} /* { dg-error "_Thread_local" } */
+typedef _Thread_local int t1; /* { dg-error "_Thread_local" } */
+_Thread_local typedef int t2; /* { dg-error "_Thread_local" } */
+
+void
+h (void)
+{
+ _Thread_local auto int a; /* { dg-error "_Thread_local" } */
+ _Thread_local register int b; /* { dg-error "_Thread_local" } */
+ auto _Thread_local int c; /* { dg-error "_Thread_local" } */
+ register _Thread_local int d; /* { dg-error "_Thread_local" } */
+ _Thread_local int e; /* { dg-error "_Thread_local" } */
+}
+
+_Thread_local int v; /* { dg-message "previous" } */
+extern int v; /* { dg-error "thread" } */
+int w; /* { dg-message "previous" } */
+extern _Thread_local int w; /* { dg-error "thread" } */
+
+_Thread_local int x; /* { dg-message "previous" } */
+int y; /* { dg-message "previous" } */
+
+int vv;
+
+void
+i (void)
+{
+ extern int x; /* { dg-error "thread" } */
+ extern _Thread_local int y; /* { dg-error "thread" } */
+ static _Thread_local int a[vv]; /* { dg-error "storage size" } */
+ static _Thread_local int vi = vv; /* { dg-error "not constant" } */
+}
+
+static _Thread_local int sv;
+
+inline void
+j (void)
+{
+ static _Thread_local int vj; /* { dg-error "static but declared" } */
+ (void) sv; /* { dg-error "static but used in inline" } */
+}