summaryrefslogtreecommitdiffstats
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authoraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-07 01:25:01 +0000
committeraldyh <aldyh@138bc75d-0d04-0410-961f-82ee72b054a4>2002-08-07 01:25:01 +0000
commit1806a3da6d102faa1b3b41c98e9520186d031b52 (patch)
tree5395e46c6dff3ce9c96f522bef40b5d5e72ad935 /gcc/c-decl.c
parentdc8c3dcf6a9efa7c9f305b054e5ca6853d555f1a (diff)
downloadppe42-gcc-1806a3da6d102faa1b3b41c98e9520186d031b52.tar.gz
ppe42-gcc-1806a3da6d102faa1b3b41c98e9520186d031b52.zip
* c-decl.c (duplicate_decls): Error out for incompatible TLS
declarations. * testsuite/gcc.dg/tls/diag-3.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56084 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index aed707db6eb..4adbe69790e 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);
OpenPOWER on IntegriCloud