decl.c (start_function): Make member functions one_only on windows.
authorJason Merrill <jason@yorick.cygnus.com>
Sun, 24 Jan 1999 00:59:21 +0000 (00:59 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 24 Jan 1999 00:59:21 +0000 (19:59 -0500)
* decl.c (start_function): Make member functions one_only on windows.
* decl2.c (import_export_decl): Likewise.
* decl.c (grokdeclarator): Don't complain about implicit int in
a system header.  Change same-name field check to not complain in
a system header instead of within extern "C".

From-SVN: r24839

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

index 280d14db9ad0006064b4540459f49b894145ed76..ab362173528c95e8768d91d9ca59f6b3317a71ed 100644 (file)
@@ -1,3 +1,12 @@
+1999-01-24  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * decl.c (start_function): Make member functions one_only on windows.
+       * decl2.c (import_export_decl): Likewise.
+
+       * decl.c (grokdeclarator): Don't complain about implicit int in
+       a system header.  Change same-name field check to not complain in
+       a system header instead of within extern "C".
+
 1999-01-21  Mark Mitchell  <mark@markmitchell.com>
 
        * cp-tree.h (PUSH_GLOBAL): New macro.
index 39e07a4ba6efdbcfe55ec6ff2b46dbbdb2166a45..e1e50f6f46e9befbf1a08881c187938b86a23c2e 100644 (file)
@@ -9384,7 +9384,9 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
                         && in_namespace == NULL_TREE
                         && current_namespace == global_namespace);
 
-         if (pedantic || ! is_main)
+         if (in_system_header)
+           /* Allow it, sigh.  */;
+         else if (pedantic || ! is_main)
            cp_pedwarn ("ANSI C++ forbids declaration `%D' with no type",
                        dname);
          else if (warn_return_type)
@@ -11050,7 +11052,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist)
                /* Divergence from the standard:  In extern "C", we
                   allow non-static data members here, because C does
                   and /usr/include/netinet/in.h uses that.  */
-               && (staticp || current_lang_name != lang_name_c))
+               && (staticp || ! in_system_header))
              cp_pedwarn ("ANSI C++ forbids data member `%D' with same name as enclosing class",
                          declarator);
 
@@ -13042,16 +13044,21 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
     }
   /* If this function belongs to an interface, it is public.
      If it belongs to someone else's interface, it is also external.
-     It doesn't matter whether it's inline or not.  */
+     This only affects inlines and template instantiations.  */
   else if (interface_unknown == 0
           && (! DECL_TEMPLATE_INSTANTIATION (decl1)
               || flag_alt_external_templates))
     {
       if (DECL_THIS_INLINE (decl1) || DECL_TEMPLATE_INSTANTIATION (decl1)
          || processing_template_decl)
-       DECL_EXTERNAL (decl1)
-         = (interface_only
-            || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines));
+       {
+         DECL_EXTERNAL (decl1)
+           = (interface_only
+              || (DECL_THIS_INLINE (decl1) && ! flag_implement_inlines));
+
+         /* For WIN32 we also want to put these in linkonce sections.  */
+         maybe_make_one_only (decl1);
+       }
       else
        DECL_EXTERNAL (decl1) = 0;
       DECL_NOT_REALLY_EXTERN (decl1) = 0;
index ed9c11b3824d93ee7fc8fa7d75ed54a221109e4c..867cf96c653f80083194ab6eadb168c6948cf711 100644 (file)
@@ -2791,6 +2791,8 @@ import_export_decl (decl)
          /* Always make artificials weak.  */
          if (DECL_ARTIFICIAL (decl) && flag_weak)
            comdat_linkage (decl);
+         else
+           maybe_make_one_only (decl);
        }
       else
        comdat_linkage (decl);