Commit 3693d46c by Joseph Myers Committed by Joseph Myers

c-decl.c (finish_decl): Apply pending #pragma weak regardless of scope.

	* c-decl.c (finish_decl): Apply pending #pragma weak regardless of
	scope.

cp:
	* decl.c (start_decl): Apply pending #pragma weak regardless of
	scope.

testsuite:
	* gcc.dg/weak/weak-12.c, g++.dg/ext/weak2.C: New tests.

From-SVN: r97733
parent c634366a
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,
......
......@@ -3262,8 +3262,7 @@ finish_decl (tree decl, tree init, tree asmspec_tree)
}
/* 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
......
......@@ -3654,8 +3654,7 @@ start_decl (const cp_declarator *declarator,
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,
gcc.dg/i386-3dnowA-2.c, gcc.dg/pr12092-1.c: Skip x86 tests for
-m64.
......
// 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;
}
/* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment