diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2002-08-07 01:25:01 +0000 |
---|---|---|
committer | Aldy Hernandez <aldyh@gcc.gnu.org> | 2002-08-07 01:25:01 +0000 |
commit | 1ae0ccb63f419456bafa7fcf72e45ced13539cc3 (patch) | |
tree | 5395e46c6dff3ce9c96f522bef40b5d5e72ad935 /gcc/c-decl.c | |
parent | f1a044c7da72e0e0a4895b7d2f53bbb4f62ba9d0 (diff) | |
download | gcc-1ae0ccb63f419456bafa7fcf72e45ced13539cc3.zip gcc-1ae0ccb63f419456bafa7fcf72e45ced13539cc3.tar.gz gcc-1ae0ccb63f419456bafa7fcf72e45ced13539cc3.tar.bz2 |
c-decl.c (duplicate_decls): Error out for incompatible TLS declarations.
* c-decl.c (duplicate_decls): Error out for incompatible TLS
declarations.
* testsuite/gcc.dg/tls/diag-3.c: New.
From-SVN: r56084
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r-- | gcc/c-decl.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c index aed707d..4adbe69 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -1400,6 +1400,20 @@ duplicate_decls (newdecl, olddecl, different_binding_level) } error_with_decl (olddecl, "previous declaration of `%s'"); } + /* TLS cannot follow non-TLS declaration. */ + else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL + && !DECL_THREAD_LOCAL (olddecl) && DECL_THREAD_LOCAL (newdecl)) + { + error_with_decl (newdecl, "thread-local declaration of `%s' follows non thread-local declaration"); + error_with_decl (olddecl, "previous declaration of `%s'"); + } + /* non-TLS declaration cannot follow TLS declaration. */ + else if (TREE_CODE (olddecl) == VAR_DECL && TREE_CODE (newdecl) == VAR_DECL + && DECL_THREAD_LOCAL (olddecl) && !DECL_THREAD_LOCAL (newdecl)) + { + error_with_decl (newdecl, "non thread-local declaration of `%s' follows thread-local declaration"); + error_with_decl (olddecl, "previous declaration of `%s'"); + } else { errmsg = redeclaration_error_message (newdecl, olddecl); |