Commits

Iain Buclaw  committed b5399a7

Refs #246 - mostly revert previous stab at fixing issue.

  • Participants
  • Parent commits 6f10e57

Comments (0)

Files changed (2)

File d/d-objfile.cc

 
 
 void
-ObjectFile::makeDeclOneOnly(tree decl_tree, bool comdat)
+ObjectFile::makeDeclOneOnly(tree decl_tree)
 {
     if (! D_DECL_IS_TEMPLATE(decl_tree) || gen.emitTemplates != TEprivate)
     {   /* Weak definitions have to be public.  Nested functions may or
            done first.  */
         if (! TREE_PUBLIC(decl_tree) ||
                 (TREE_CODE(decl_tree) == FUNCTION_DECL &&
-                 decl_function_context(decl_tree) != NULL_TREE &&
+                 DECL_CONTEXT(decl_tree) != NULL_TREE &&
                  DECL_STATIC_CHAIN(decl_tree)))
             return;
     }
        even if the target supports one-only. */
     if (! D_DECL_IS_TEMPLATE(decl_tree) || gen.emitTemplates != TEprivate)
     {
-        /* MinGW requires a comdat_group to take advantage of 
-           make_decl_one_only. */
-#ifdef TARGET_WINDOS
-        comdat = true;
-#endif
-        
         /* The following makes assumptions about the behavior
            of make_decl_one_only */
         if (SUPPORTS_ONE_ONLY)
         {
-            make_decl_one_only(decl_tree, comdat ? d_comdat_group(decl_tree) : NULL_TREE);
+            make_decl_one_only(decl_tree, d_comdat_group(decl_tree));
         }
         else if (SUPPORTS_WEAK)
         {
             sym = sym->toParent();
         }
 
+        is_comdat = real_decl && (real_decl->storage_class & STCcomdat);
+
         if (is_template)
         {
             D_DECL_ONE_ONLY(decl_tree) = 1;
         else
             is_static = hasModule(dsym->getModule());
 
-        is_comdat = real_decl && (real_decl->storage_class & STCcomdat);
-
         if (real_decl && TREE_CODE(decl_tree) == VAR_DECL)
         {
             if (real_decl->storage_class & STCextern)
             TREE_PUBLIC(decl_tree) = 1;
 
         if (D_DECL_ONE_ONLY(decl_tree))
-            makeDeclOneOnly(decl_tree, is_comdat);
+            makeDeclOneOnly(decl_tree);
 
     }
     else

File d/d-objfile.h

     // Definitely in static data, but not neccessarily this module.
     // Assumed to be public data.
     static void setupStaticStorage(Dsymbol * dsym, tree decl_tree);
-    static void makeDeclOneOnly(tree decl_tree, bool comdat = true);
+    static void makeDeclOneOnly(tree decl_tree);
 
     static void outputStaticSymbol(Symbol * s);
     static void outputFunction(FuncDeclaration * f);