* gcc.dg/tls/tls.exp, gcc.dg/tls/trivial.c, gcc.dg/tls/diag-1.c,
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 May 2002 01:12:13 +0000 (01:12 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 22 May 2002 01:12:13 +0000 (01:12 +0000)
        gcc.dg/tls/diag-2.c, gcc.dg/tls/init-1.c: New directory and files.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@53716 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tls/diag-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tls/diag-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tls/init-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tls/tls.exp [new file with mode: 0644]
gcc/testsuite/gcc.dg/tls/trivial.c [new file with mode: 0644]

index da87b8c..0459dec 100644 (file)
@@ -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 (file)
index 0000000..ae4f3d4
--- /dev/null
@@ -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 (file)
index 0000000..4f2b90b
--- /dev/null
@@ -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 (file)
index 0000000..9725864
--- /dev/null
@@ -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 (file)
index 0000000..4c2627d
--- /dev/null
@@ -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 (file)
index 0000000..1fd7063
--- /dev/null
@@ -0,0 +1 @@
+__thread int i;