+2005-04-06 Joseph S. Myers <joseph@codesourcery.com>
+
+ * c-decl.c (finish_decl): Apply pending #pragma weak regardless of
+ scope.
+
2005-04-06 Kazu Hirata <kazu@cs.umass.edu>
* cse.c, tree-flow-inline.h, tree-flow.h, tree-ssa-operands.c,
}
/* If #pragma weak was used, mark the decl weak now. */
- if (current_scope == file_scope)
- maybe_apply_pragma_weak (decl);
+ maybe_apply_pragma_weak (decl);
/* If this is a variable definition, determine its ELF visibility. */
if (TREE_CODE (decl) == VAR_DECL
+2005-04-06 Joseph S. Myers <joseph@codesourcery.com>
+
+ * decl.c (start_decl): Apply pending #pragma weak regardless of
+ scope.
+
2005-04-06 Mark Mitchell <mark@codesourcery.com>
PR c++/20212
cplus_decl_attributes (&decl, attributes, 0);
/* If #pragma weak was used, mark the decl weak now. */
- if (global_scope_p (current_binding_level))
- maybe_apply_pragma_weak (decl);
+ maybe_apply_pragma_weak (decl);
if (TREE_CODE (decl) == FUNCTION_DECL
&& DECL_DECLARED_INLINE_P (decl)
+2005-04-06 Joseph S. Myers <joseph@codesourcery.com>
+
+ * gcc.dg/weak/weak-12.c, g++.dg/ext/weak2.C: New tests.
+
2005-04-06 Joseph S. Myers <joseph@codesourcery.com>
* gcc.dg/i386-387-7.c, gcc.dg/i386-3dnowA-1.c,
--- /dev/null
+// Test for #pragma weak with declaration not at file scope.
+// { dg-do compile }
+// { dg-require-weak "" }
+// { dg-options "" }
+
+// { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?_Z3foov" } }
+
+#pragma weak _Z3foov
+
+int
+main (void)
+{
+ extern int foo (void);
+ if (&foo)
+ return foo ();
+ return 0;
+}
--- /dev/null
+/* Test for #pragma weak with declaration not at file scope. */
+/* { dg-do compile } */
+/* { dg-require-weak "" } */
+/* { dg-options "" } */
+
+/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?foo" } } */
+
+#pragma weak foo
+
+int
+main (void)
+{
+ extern int foo (void);
+ if (&foo)
+ return foo ();
+ return 0;
+}