decl2.c (get_guard): Set linkage from guarded decl.
authorNathan Sidwell <nathan@codesourcery.com>
Thu, 11 Jan 2001 13:34:00 +0000 (13:34 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Thu, 11 Jan 2001 13:34:00 +0000 (13:34 +0000)
cp:
* decl2.c (get_guard): Set linkage from guarded decl.

From-SVN: r38905

gcc/cp/ChangeLog
gcc/cp/decl2.c

index 0981c7eab9b68eae34c9bb825b85dae0928583aa..995f49e6eaab503a5b426d84f371f86f1702fdf9 100644 (file)
@@ -1,3 +1,7 @@
+2001-01-11  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * decl2.c (get_guard): Set linkage from guarded decl.
+
 2001-01-11  Nathan Sidwell  <nathan@codesourcery.com>
 
        * call.c (convert_default_arg): Check for unprocessed
index e09905672c3e904fa69fd1ea8c0a0e881fb08b04..3f15b38be1f90ea719e289a24d4a08ae585727c8 100644 (file)
@@ -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);
     }