summaryrefslogtreecommitdiff
path: root/gcc/cp/tree.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-20 16:02:57 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2006-07-20 16:02:57 +0000
commit6a47600ccb509de8d9fc9f603e91990ae71479c1 (patch)
tree2668380ba111a9cfdf1beb690c74127fc5593651 /gcc/cp/tree.c
parentd249588e4325dd5715ee30acfd2e97701407b5fa (diff)
downloadgcc-6a47600ccb509de8d9fc9f603e91990ae71479c1.tar.gz
PR c++/28407
* cp/decl.c (grokvardecl): Set DECL_THIS_STATIC on file-scope const variables with implicit internal linkage. * cp/tree.c (decl_linkage): Only return lk_external if it's set. PR c++/28409 * cp/decl2.c (constrain_visibility): Ignore the anonymous namespace for extern C decls. (VISIBILITY_STATIC): Rename to VISIBILITY_ANON. Don't override explicit visibility. * cp/decl2.c (constrain_visibility): Remove specified and reason parameters. Don't touch decls that already have explicit visibility. (determine_visibility): Do copy DECL_VISIBILITY_SPECIFIED from template. (determine_visibility_from_class): Reverse sense of DECL_VISIBILITY_SPECIFIED test for target-specific visibility rules. (constrain_class_visibility): Only complain about member visibility if the member type is another class. Don't change visibility of the current class. * tree.c (remove_attribute): New fn. * tree.h: Declare it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115622 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/tree.c')
-rw-r--r--gcc/cp/tree.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index c1c6719e8ef..0d42502da76 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -2195,6 +2195,9 @@ decl_linkage (tree decl)
if (TREE_PUBLIC (decl))
return lk_external;
+ if (TREE_CODE (decl) == NAMESPACE_DECL)
+ return lk_external;
+
/* Linkage of a CONST_DECL depends on the linkage of the enumeration
type. */
if (TREE_CODE (decl) == CONST_DECL)
@@ -2214,6 +2217,14 @@ decl_linkage (tree decl)
if (decl_function_context (decl))
return lk_none;
+ /* Members of the anonymous namespace also have TREE_PUBLIC unset, but
+ are considered to have external linkage for language purposes. DECLs
+ really meant to have internal linkage have DECL_THIS_STATIC set. */
+ if (TREE_CODE (decl) == TYPE_DECL
+ || ((TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == FUNCTION_DECL)
+ && !DECL_THIS_STATIC (decl)))
+ return lk_external;
+
/* Everything else has internal linkage. */
return lk_internal;
}