diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2004-09-11 22:29:42 +0100 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2004-09-11 22:29:42 +0100 |
commit | 9a26d6ee086c424a32fefd09f55ff314afc2a051 (patch) | |
tree | 2e7db2782d1466e19e91914d252ee32d24f2052e /gcc/testsuite/gcc.dg/tls | |
parent | e6858057449b72a53389616073b72b3778c2cf63 (diff) | |
download | gcc-9a26d6ee086c424a32fefd09f55ff314afc2a051.zip gcc-9a26d6ee086c424a32fefd09f55ff314afc2a051.tar.gz gcc-9a26d6ee086c424a32fefd09f55ff314afc2a051.tar.bz2 |
c-tree.h (enum c_storage_class): New.
* c-tree.h (enum c_storage_class): New.
(struct c_declspecs): Add storage_class, inline_p and thread_p.
* c-decl.c (shadow_tag_warned): Give errors for "inline" in empty
declarations and "auto" or "register" in file scope empty
declarations. Give more specific warnings for other cases of
storage class specifiers in empty declarations.
(grokdeclarator): Update for new structures. Don't check for
multiple storage classes. Diagnose file-scope "register" if
pedantic.
(build_null_declspecs): Update.
(declspecs_add_scspec): Update. Diagnose multiple storage class
specifiers and invalid uses of "__thread".
testsuite:
* gcc.dg/declspec-4.c, gcc.dg/declspec-5.c, gcc.dg/declspec-6.c,
gcc.dg/tls/diag-2.c: Update expected messages.
* gcc.dg/991209-1.c: Specify compilation options. Update expected
messages.
* gcc.dg/pr14289-2.c, gcc.dg/pr14289-3.c: Remove.
* gcc.dg/declspec-7.c, gcc.dg/declspec-8.c, gcc.dg/declspec-9.c,
gcc.dg/declspec-10.c, gcc.dg/declspec-11.c, gcc.dg/tls/diag-4.c,
gcc.dg/tls/diag-5.c: New tests.
From-SVN: r87374
Diffstat (limited to 'gcc/testsuite/gcc.dg/tls')
-rw-r--r-- | gcc/testsuite/gcc.dg/tls/diag-2.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tls/diag-4.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/tls/diag-5.c | 3 |
3 files changed, 18 insertions, 5 deletions
diff --git a/gcc/testsuite/gcc.dg/tls/diag-2.c b/gcc/testsuite/gcc.dg/tls/diag-2.c index 3c5d9bd..5e7e17b 100644 --- a/gcc/testsuite/gcc.dg/tls/diag-2.c +++ b/gcc/testsuite/gcc.dg/tls/diag-2.c @@ -3,19 +3,19 @@ __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" } */ +typedef __thread int g4; /* { dg-error "'__thread' used with 'typedef'" } */ void foo() { - __thread int l1; /* { dg-error "implicitly auto and declared `__thread'" } */ - auto __thread int l2; /* { dg-error "multiple storage classes" } */ + __thread int l1; /* { dg-error "implicitly auto and declared '__thread'" } */ + auto __thread int l2; /* { dg-error "'__thread' used with 'auto'" } */ __thread extern int l3; /* { dg-error "'__thread' before 'extern'" } */ - register __thread int l4; /* { dg-error "multiple storage classes" } */ + register __thread int l4; /* { dg-error "'__thread' used with 'register'" } */ } __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'" } */ +__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/diag-4.c b/gcc/testsuite/gcc.dg/tls/diag-4.c new file mode 100644 index 0000000..df3705d --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/diag-4.c @@ -0,0 +1,10 @@ +/* Invalid __thread specifiers. As diag-4.c but some cases in + different orders. */ + +__thread typedef int g4; /* { dg-error "'__thread' used with 'typedef'" } */ + +void foo() +{ + __thread auto int l2; /* { dg-error "'__thread' used with 'auto'" } */ + __thread register int l4; /* { dg-error "'__thread' used with 'register'" } */ +} diff --git a/gcc/testsuite/gcc.dg/tls/diag-5.c b/gcc/testsuite/gcc.dg/tls/diag-5.c new file mode 100644 index 0000000..623832c --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/diag-5.c @@ -0,0 +1,3 @@ +/* __thread specifiers on empty declarations. */ + +__thread struct foo; /* { dg-warning "warning: useless '__thread' in empty declaration" } */ |