* varasm.c (merge_weak): Remove special case for extern and common.
* gcc.dg/weak-5.c (vfoo1c, vfoo1g): Warn here.
From-SVN: r53498
+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
+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.
{
return (void *)&vfoo1c;
}
-extern int vfoo1c __attribute__((weak));
+extern int vfoo1c __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
extern int vfoo1d __attribute__((weak));
{
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;
{
return (void *)&vfoo1g;
}
-int vfoo1g __attribute__((weak));
+int vfoo1g __attribute__((weak)); /* { dg-warning "unspecified behavior" } */
extern int vfoo1h __attribute__((weak));
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)