From ec221d715c730de2214d2bf4cab8b37633787ff7 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 21 May 2002 18:12:13 -0700 Subject: [PATCH] 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 --- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/tls/diag-1.c | 11 ++++++++ gcc/testsuite/gcc.dg/tls/diag-2.c | 21 ++++++++++++++ gcc/testsuite/gcc.dg/tls/init-1.c | 4 +++ gcc/testsuite/gcc.dg/tls/tls.exp | 45 ++++++++++++++++++++++++++++++ gcc/testsuite/gcc.dg/tls/trivial.c | 1 + 6 files changed, 87 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tls/diag-1.c create mode 100644 gcc/testsuite/gcc.dg/tls/diag-2.c create mode 100644 gcc/testsuite/gcc.dg/tls/init-1.c create mode 100644 gcc/testsuite/gcc.dg/tls/tls.exp create mode 100644 gcc/testsuite/gcc.dg/tls/trivial.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index da87b8c77b9..0459deceec6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2002-05-21 Richard Henderson + + * 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 * 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 00000000000..ae4f3d4a3c2 --- /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 00000000000..4f2b90b8f7e --- /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 00000000000..97258643bf2 --- /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 00000000000..4c2627dbcf8 --- /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 00000000000..1fd70631f33 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/trivial.c @@ -0,0 +1 @@ +__thread int i; -- 2.30.2