aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-01-11 13:34:00 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-01-11 13:34:00 +0000
commit844511c89b97334861a86c28927a5e14a6680d84 (patch)
tree99ca05ec0da744db3947f2e69d1a7b4b19aa84d3 /gcc/cp/decl2.c
parent79c9e15977b46189fe906d1879de77d7dec335e6 (diff)
downloadgcc-844511c89b97334861a86c28927a5e14a6680d84.zip
gcc-844511c89b97334861a86c28927a5e14a6680d84.tar.gz
gcc-844511c89b97334861a86c28927a5e14a6680d84.tar.bz2
decl2.c (get_guard): Set linkage from guarded decl.
cp: * decl2.c (get_guard): Set linkage from guarded decl. From-SVN: r38905
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index e099056..3f15b38 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -2856,11 +2856,17 @@ get_guard (decl)
guard_type = integer_type_node;
guard = build_decl (VAR_DECL, sname, guard_type);
- TREE_PUBLIC (guard) = 1;
+
+ /* The guard should have the same linkage as what it guards. */
+ TREE_PUBLIC (guard) = TREE_PUBLIC (decl);
+ TREE_STATIC (guard) = TREE_STATIC (decl);
+ DECL_COMMON (guard) = DECL_COMMON (decl);
+ DECL_ONE_ONLY (guard) = DECL_ONE_ONLY (decl);
+ if (TREE_PUBLIC (decl))
+ DECL_WEAK (guard) = DECL_WEAK (decl);
+
DECL_ARTIFICIAL (guard) = 1;
- TREE_STATIC (guard) = 1;
TREE_USED (guard) = 1;
- DECL_COMMON (guard) = 1;
pushdecl_top_level (guard);
cp_finish_decl (guard, NULL_TREE, NULL_TREE, 0);
}