aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-11-08 21:44:58 +0000
committerJakub Jelinek <jakub@redhat.com>2005-11-08 21:44:58 +0000
commit2ca394f1adf0702d414de0d31651156e01414e6a (patch)
treec3d8a4d48d1074926a1e30b5347d5e5bdfc1a4b8 /gcc/cp
parentff8457cead95da97c22dbf6b32b32742a1713b18 (diff)
PR c++/19450
* decl.c (redeclaration_error_message): Issue diagnostics about olddecl and newdecl disagreement on __thread property. (grokdeclarator): Set DECL_TLS_MODEL on class static variables. * g++.dg/tls/diag-3.C: New test. * g++.dg/tls/diag-4.C: New test. * g++.dg/tls/static-1.C: New test. * g++.dg/tls/static-1a.cc: New file. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@106657 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl.c23
2 files changed, 30 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1b2d16661ab..bcbddc7fbd9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-08 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/19450
+ * decl.c (redeclaration_error_message): Issue diagnostics about
+ olddecl and newdecl disagreement on __thread property.
+ (grokdeclarator): Set DECL_TLS_MODEL on class static variables.
+
2005-11-08 Jason Merrill <jason@redhat.com>
PR c++/21123
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index c5fe6585996..7263b32d2ee 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -2014,6 +2014,18 @@ redeclaration_error_message (tree newdecl, tree olddecl)
return NULL;
}
+ else if (TREE_CODE (newdecl) == VAR_DECL
+ && DECL_THREAD_LOCAL_P (newdecl) != DECL_THREAD_LOCAL_P (olddecl))
+ {
+ /* Only variables can be thread-local, and all declarations must
+ agree on this property. */
+ if (DECL_THREAD_LOCAL_P (newdecl))
+ return "thread-local declaration of %q#D follows "
+ "non-thread-local declaration";
+ else
+ return "non-thread-local declaration of %q#D follows "
+ "thread-local declaration";
+ }
else if (toplevel_bindings_p () || DECL_NAMESPACE_SCOPE_P (newdecl))
{
/* Objects declared at top level: */
@@ -8216,6 +8228,17 @@ grokdeclarator (const cp_declarator *declarator,
is considered undefined until an out-of-class
definition is provided. */
DECL_EXTERNAL (decl) = 1;
+
+ if (thread_p)
+ {
+ if (targetm.have_tls)
+ DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+ else
+ /* A mere warning is sure to result in improper
+ semantics at runtime. Don't bother to allow this to
+ compile. */
+ error ("thread-local storage not supported for this target");
+ }
}
else
{