diff options
author | sirl <sirl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-28 18:31:34 +0000 |
---|---|---|
committer | sirl <sirl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-28 18:31:34 +0000 |
commit | 296c463e520419ac1adf0f5a90fd4c7470130451 (patch) | |
tree | bf07a3136b537dc0844e7c227d87d6ade6e858ef /gcc/c-pragma.c | |
parent | 2493f5d5862475a536a05867536687c5cdacd8b2 (diff) | |
download | gcc-296c463e520419ac1adf0f5a90fd4c7470130451.tar.gz |
2002-04-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
PR c/6343
* c-decl.c (duplicate_decls): Call merge_weak.
* c-pragma.c (apply_pragma_weak): Warn about misuse.
* output.h (merge_weak): Prototype merge_weak.
* varasm.c (merge_weak): New function.
(declare_weak): Make sure we don't give an error on VAR_DECLs.
Mark RTL with SYMBOL_REF_WEAK.
cp:
* decl.c (duplicate_decls): Call merge_weak.
testsuite:
* gcc.dg/weak-[2-7].c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52844 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-pragma.c')
-rw-r--r-- | gcc/c-pragma.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index 4bf7ce205ac..d5df3559597 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -287,6 +287,10 @@ apply_pragma_weak (decl, value) decl_attributes (&decl, build_tree_list (get_identifier ("alias"), build_tree_list (NULL, value)), 0); + if (SUPPORTS_WEAK && DECL_EXTERNAL (decl) && TREE_USED (decl) + && TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))) + warning_with_decl (decl, "applying #pragma weak `%s' after first use results in unspecified behavior"); + declare_weak (decl); } |