varasm.c (merge_weak): Remove special case for extern and common.
authorRichard Henderson <rth@redhat.com>
Thu, 16 May 2002 00:14:24 +0000 (17:14 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Thu, 16 May 2002 00:14:24 +0000 (17:14 -0700)
        * varasm.c (merge_weak): Remove special case for extern and common.

        * gcc.dg/weak-5.c (vfoo1c, vfoo1g): Warn here.

From-SVN: r53498

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/weak-5.c
gcc/varasm.c

index a83b9034d4e72c0bb72797183f9fd5ffd5fd425c..714b5fda51e4c6324144e82c46ede5df50f53d30 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-15  Richard Henderson  <rth@redhat.com>
+
+       * varasm.c (merge_weak): Remove special case for extern and common.
+
 2002-05-15  Matt Hiller  <hiller@redhat.com>
 
        * testsuite/gcc.c-torture/compile/20000804-1.x: Don't return 1 if
index 5676c95265e30dffe3afff7905d5b5bd5eff71c5..e2b5ff06f469a485cd2e61af3fecc5cd7b6f30d0 100644 (file)
@@ -1,3 +1,7 @@
+2002-05-15  Richard Henderson  <rth@redhat.com>
+
+       * gcc.dg/weak-5.c (vfoo1c, vfoo1g): Warn here.
+
 2002-05-15  Richard Henderson  <rth@redhat.com>
 
        * gcc.dg/weak-5.c (vfoo1c): No warning here.
index e531b27beebcc658a05b794cc7f94b795e52e45a..8576379d3fb733bc4e426129ad0a53bfd9d45b18 100644 (file)
@@ -44,7 +44,7 @@ void * foo1c (void)
 {
   return (void *)&vfoo1c;
 }
-extern int vfoo1c __attribute__((weak));
+extern int vfoo1c __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
 
 
 extern int vfoo1d __attribute__((weak));
@@ -68,7 +68,7 @@ void * foo1f (void)
 {
   return (void *)&vfoo1f;
 }
-extern int vfoo1f __attribute__((weak)); /* { dg-warning "weak declaration" "weak declaration" } */
+extern int vfoo1f __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
 
 
 extern int vfoo1g;
@@ -76,7 +76,7 @@ void * foo1g (void)
 {
   return (void *)&vfoo1g;
 }
-int vfoo1g __attribute__((weak));
+int vfoo1g __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
 
 
 extern int vfoo1h __attribute__((weak));
index 05a8ada095b35d8ae30366a07a5a10358fa86999..4a8841230282ac85741ed60ebb70fd82eaed210c 100644 (file)
@@ -4848,16 +4848,7 @@ merge_weak (newdecl, olddecl)
         have done so in a way that will not function properly with
         a weak symbol.  */
       else if (TREE_USED (olddecl)
-              && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (olddecl))
-              /* ??? Not impossible that some platform may generate code
-                 that doesn't function *at all* with incorrect declaration
-                 before use.  However, all known at present will assume
-                 exteral and common symbols are not "local".  */
-              /* ??? Probably these exceptions to the rule will just
-                 confuse users about the true nature of the problem and
-                 we should warn for *any* use before weakening.  */
-              && ! (DECL_EXTERNAL (olddecl)
-                    || DECL_COMMON (olddecl)))
+              && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (olddecl)))
        warning_with_decl (newdecl, "weak declaration of `%s' after first use results in unspecified behavior");
 
       if (SUPPORTS_WEAK)