aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-05-21 18:12:13 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-05-21 18:12:13 -0700
commitec221d715c730de2214d2bf4cab8b37633787ff7 (patch)
tree2363f267a50cd81662c0013864728e3a333a0cc0
parent3d78f2e96e29feaff7046c22fdc97aa58bee9688 (diff)
downloadgcc-ec221d715c730de2214d2bf4cab8b37633787ff7.zip
gcc-ec221d715c730de2214d2bf4cab8b37633787ff7.tar.gz
gcc-ec221d715c730de2214d2bf4cab8b37633787ff7.tar.bz2
tls.exp, [...]: New directory and files.
* gcc.dg/tls/tls.exp, gcc.dg/tls/trivial.c, gcc.dg/tls/diag-1.c, gcc.dg/tls/diag-2.c, gcc.dg/tls/init-1.c: New directory and files. From-SVN: r53716
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-1.c11
-rw-r--r--gcc/testsuite/gcc.dg/tls/diag-2.c21
-rw-r--r--gcc/testsuite/gcc.dg/tls/init-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/tls/tls.exp45
-rw-r--r--gcc/testsuite/gcc.dg/tls/trivial.c1
6 files changed, 87 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index da87b8c..0459dece 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-21 Richard Henderson <rth@redhat.com>
+
+ * gcc.dg/tls/tls.exp, gcc.dg/tls/trivial.c, gcc.dg/tls/diag-1.c,
+ gcc.dg/tls/diag-2.c, gcc.dg/tls/init-1.c: New directory and files.
+
Tue May 21 14:25:32 2002 Brian R. Gaeke <brg@dgate.ORG>
* g++.dg/other/copy2.C: New test.
diff --git a/gcc/testsuite/gcc.dg/tls/diag-1.c b/gcc/testsuite/gcc.dg/tls/diag-1.c
new file mode 100644
index 0000000..ae4f3d4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/diag-1.c
@@ -0,0 +1,11 @@
+/* Valid __thread specifiers. */
+
+__thread int g1;
+extern __thread int g2;
+static __thread int g3;
+
+void foo()
+{
+ extern __thread int l1;
+ static __thread int l2;
+}
diff --git a/gcc/testsuite/gcc.dg/tls/diag-2.c b/gcc/testsuite/gcc.dg/tls/diag-2.c
new file mode 100644
index 0000000..4f2b90b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/diag-2.c
@@ -0,0 +1,21 @@
+/* Invalid __thread specifiers. */
+
+__thread extern int g1; /* { dg-error "`__thread' before `extern'" } */
+__thread static int g2; /* { dg-error "`__thread' before `static'" } */
+__thread __thread int g3; /* { dg-error "duplicate `__thread'" } */
+typedef __thread int g4; /* { dg-error "multiple storage classes" } */
+
+void foo()
+{
+ __thread int l1; /* { dg-error "implicitly auto and declared `__thread'" } */
+ auto __thread int l2; /* { dg-error "multiple storage classes" } */
+ __thread extern int l3; /* { dg-error "`__thread' before `extern'" } */
+ register __thread int l4; /* { dg-error "multiple storage classes" } */
+}
+
+__thread void f1 (); /* { dg-error "invalid storage class for function" } */
+extern __thread void f2 (); /* { dg-error "invalid storage class for function" } */
+static __thread void f3 (); /* { dg-error "invalid storage class for function" } */
+__thread void f4 () { } /* { dg-error "function definition declared `__thread'" } */
+
+void bar(__thread int p1); /* { dg-error "storage class specified for parameter" } */
diff --git a/gcc/testsuite/gcc.dg/tls/init-1.c b/gcc/testsuite/gcc.dg/tls/init-1.c
new file mode 100644
index 0000000..9725864
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/init-1.c
@@ -0,0 +1,4 @@
+/* Invalid initializations. */
+
+extern __thread int i;
+int *p = &i; /* { dg-error "initializer element is not constant" } */
diff --git a/gcc/testsuite/gcc.dg/tls/tls.exp b/gcc/testsuite/gcc.dg/tls/tls.exp
new file mode 100644
index 0000000..4c2627d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/tls.exp
@@ -0,0 +1,45 @@
+# Copyright (C) 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# GCC testsuite that uses the `dg.exp' driver.
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# Test for thread-local data supported by the platform. If it
+# isn't, everything will fail with the "not supported" message.
+
+set comp_output [gcc_target_compile \
+ "$srcdir/$subdir/trivial.c" "trivial.S" assembly ""]
+if { [string match "*not supported*" $comp_output] } {
+ return 0
+}
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+ set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] \
+ "" $DEFAULT_CFLAGS
+
+# All done.
+dg-finish
diff --git a/gcc/testsuite/gcc.dg/tls/trivial.c b/gcc/testsuite/gcc.dg/tls/trivial.c
new file mode 100644
index 0000000..1fd7063
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tls/trivial.c
@@ -0,0 +1 @@
+__thread int i;