diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-29 18:54:06 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-11-29 18:54:06 +0000 |
commit | b42190bc5c772307c6b0b13a2bd678054df176cc (patch) | |
tree | 09efe121e3a286e0aae7308c8245228e8c339428 | |
parent | ac6cd2a261f9ca7349a8aaf9e288605a80521944 (diff) | |
download | gcc-b42190bc5c772307c6b0b13a2bd678054df176cc.tar.gz |
2004-11-29 Daniel Jacobowitz <dan@codesourcery.com>
PR c/7544
* Makefile.in (c-lang.o): Update dependencies.
* c-lang.c: Include "c-pragma.h".
(finish_file): Call maybe_apply_pending_pragma_weaks.
* c-pragma.c (maybe_apply_pending_pragma_weaks): New function.
* c-pragma.h (maybe_apply_pending_pragma_weaks): New prototype.
cp:
2004-11-29 Daniel Jacobowitz <dan@codesourcery.com>
* Make-lang.in (cp/decl2.o): Update dependencies.
* decl2.c (finish_file): Call maybe_apply_pending_pragma_weaks.
objc:
2004-11-29 Joseph Myers <joseph@codesourcery.com>
* Make-lang.in (objc/objc-act.o): Update dependencies.
* objc-act.c (objc_finish_file): Call
maybe_apply_pending_pragma_weaks if not OBJCPLUS.
testsuite:
2004-11-29 Joseph Myers <joseph@codesourcery.com>
* g++.dg/ext/weak1.C, gcc.dg/weak/weak-10.c, objc.dg/weak-1.m: New
tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91479 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/Makefile.in | 2 | ||||
-rw-r--r-- | gcc/c-lang.c | 2 | ||||
-rw-r--r-- | gcc/c-pragma.c | 32 | ||||
-rw-r--r-- | gcc/c-pragma.h | 1 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/Make-lang.in | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 4 | ||||
-rw-r--r-- | gcc/objc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/objc/Make-lang.in | 2 | ||||
-rw-r--r-- | gcc/objc/objc-act.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ext/weak1.C | 13 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/weak/weak-10.c | 13 | ||||
-rw-r--r-- | gcc/testsuite/objc.dg/weak-1.m | 13 |
15 files changed, 113 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ed8056abb4d..8a2c5f84f52 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2004-11-29 Daniel Jacobowitz <dan@codesourcery.com> + + PR c/7544 + * Makefile.in (c-lang.o): Update dependencies. + * c-lang.c: Include "c-pragma.h". + (finish_file): Call maybe_apply_pending_pragma_weaks. + * c-pragma.c (maybe_apply_pending_pragma_weaks): New function. + * c-pragma.h (maybe_apply_pending_pragma_weaks): New prototype. + 2004-11-29 Richard Henderson <rth@redhat.com> PR target/17224 diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 74d362ccc81..09195be8167 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1380,7 +1380,7 @@ c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $( c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ $(C_TREE_H) $(C_PRETTY_PRINT_H) $(DIAGNOSTIC_H) \ $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \ - c-objc-common.h + c-objc-common.h c-pragma.h stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \ $(GGC_H) $(C_COMMON_H) c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \ diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 8eb090c4d62..15524480c47 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -34,6 +34,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "diagnostic.h" #include "c-pretty-print.h" #include "c-objc-common.h" +#include "c-pragma.h" enum c_language_kind c_language = clk_c; @@ -88,6 +89,7 @@ const char *const tree_code_name[] = { void finish_file (void) { + maybe_apply_pending_pragma_weaks (); } #include "gtype-c.h" diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index 91efc4aa384..cc1dd280359 100644 --- a/gcc/c-pragma.c +++ b/gcc/c-pragma.c @@ -294,6 +294,33 @@ maybe_apply_pragma_weak (tree decl) } } +/* Process all "#pragma weak A = B" directives where we have not seen + a decl for A. */ +void +maybe_apply_pending_pragma_weaks (void) +{ + tree *p, t, alias_id, id, decl, *next; + + for (p = &pending_weaks; (t = *p) ; p = next) + { + next = &TREE_CHAIN (t); + alias_id = TREE_PURPOSE (t); + id = TREE_VALUE (t); + + if (TREE_VALUE (t) == NULL) + continue; + + decl = build_decl (FUNCTION_DECL, alias_id, default_function_type); + + DECL_ARTIFICIAL (decl) = 1; + TREE_PUBLIC (decl) = 1; + DECL_EXTERNAL (decl) = 1; + DECL_WEAK (decl) = 1; + + assemble_alias (decl, id); + } +} + /* #pragma weak name [= value] */ static void handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy)) @@ -330,6 +357,11 @@ void maybe_apply_pragma_weak (tree ARG_UNUSED (decl)) { } + +void +maybe_apply_pending_pragma_weaks (void) +{ +} #endif /* HANDLE_PRAGMA_WEAK */ /* GCC supports two #pragma directives for renaming the external diff --git a/gcc/c-pragma.h b/gcc/c-pragma.h index 669d122e695..f7f609c407f 100644 --- a/gcc/c-pragma.h +++ b/gcc/c-pragma.h @@ -60,6 +60,7 @@ extern void c_register_pragma (const char *, const char *, extern void c_register_pragma_with_expansion (const char *, const char *, void (*) (struct cpp_reader *)); extern void maybe_apply_pragma_weak (tree); +extern void maybe_apply_pending_pragma_weaks (void); extern tree maybe_apply_renaming_pragma (tree, tree); extern void add_to_renaming_pragma_list (tree, tree); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e2f7dc49aa3..1a1dcbeb87b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-11-29 Daniel Jacobowitz <dan@codesourcery.com> + + PR c/7544 + * Make-lang.in (cp/decl2.o): Update dependencies. + * decl2.c (finish_file): Call maybe_apply_pending_pragma_weaks. + 2004-11-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> PR c++/18652 diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index 245f4063962..8757116648f 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -232,7 +232,8 @@ cp/decl.o: cp/decl.c $(CXX_TREE_H) $(TM_H) flags.h cp/decl.h \ cp/operators.def $(TM_P_H) tree-inline.h diagnostic.h c-pragma.h \ debug.h gt-cp-decl.h timevar.h $(TREE_FLOW_H) cp/decl2.o: cp/decl2.c $(CXX_TREE_H) $(TM_H) flags.h cp/decl.h $(EXPR_H) \ - output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h cgraph.h + output.h except.h toplev.h $(RTL_H) c-common.h gt-cp-decl2.h cgraph.h \ + c-pragma.h cp/cp-objcp-common.o : cp/cp-objcp-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ $(TM_H) $(TREE_H) $(CXX_TREE_H) c-common.h toplev.h langhooks.h \ $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) debug.h $(CXX_PRETTY_PRINT_H) \ diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 3b97367e761..88fba4f55e8 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */ #include "tree-mudflap.h" #include "cgraph.h" #include "tree-inline.h" +#include "c-pragma.h" extern cpp_reader *parse_in; @@ -3062,6 +3063,9 @@ cp_finish_file (void) if (priority_info_map) splay_tree_delete (priority_info_map); + /* Generate any missing aliases. */ + maybe_apply_pending_pragma_weaks (); + /* We're done with static constructors, so we can go back to "C++" linkage now. */ pop_lang_context (); diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 6eaa96429da..e745f41f9d7 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,10 @@ +2004-11-29 Joseph Myers <joseph@codesourcery.com> + + PR c/7544 + * Make-lang.in (objc/objc-act.o): Update dependencies. + * objc-act.c (objc_finish_file): Call + maybe_apply_pending_pragma_weaks if not OBJCPLUS. + 2004-11-09 Andrew Pinski <pinskia@physics.uc.edu> PR objc/18406 diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index d0900243c26..08909437aa6 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -73,7 +73,7 @@ objc/objc-act.o : objc/objc-act.c \ $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \ $(EXPR_H) $(TARGET_H) $(C_TREE_H) diagnostic.h toplev.h flags.h \ objc/objc-act.h input.h function.h output.h debug.h langhooks.h \ - $(LANGHOOKS_DEF_H) $(HASHTAB_H) gt-objc-objc-act.h + $(LANGHOOKS_DEF_H) $(HASHTAB_H) c-pragma.h gt-objc-objc-act.h objc.srcextra: objc/objc-parse.c objc/objc-parse.y -cp -p $^ $(srcdir)/objc diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 408f25709a4..2da313d2983 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -55,6 +55,7 @@ Boston, MA 02111-1307, USA. */ #endif #include "c-common.h" +#include "c-pragma.h" #include "flags.h" #include "langhooks.h" #include "objc-act.h" @@ -602,6 +603,8 @@ objc_finish_file (void) #ifdef OBJCPLUS cp_finish_file (); +#else + maybe_apply_pending_pragma_weaks (); #endif } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 289d124d3de..83f1554f409 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2004-11-29 Joseph Myers <joseph@codesourcery.com> + + PR c/7544 + * g++.dg/ext/weak1.C, gcc.dg/weak/weak-10.c, objc.dg/weak-1.m: New + tests. + 2004-11-29 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> PR c++/18652 diff --git a/gcc/testsuite/g++.dg/ext/weak1.C b/gcc/testsuite/g++.dg/ext/weak1.C new file mode 100644 index 00000000000..b7a448f371b --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/weak1.C @@ -0,0 +1,13 @@ +// Test for #pragma weak where the weak alias symbol isn't declared, +// although the symbol it is an alias for is defined in the +// translation unit. Bug 7544. +// Origin: Joseph Myers <joseph@codesourcery.com> +// { dg-do compile } +// { dg-require-weak "" } +// { dg-require-alias "" } +// { dg-options "-fno-common" } + +// { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?bar1" } } + +#pragma weak bar1 = foo1 +extern "C" void foo1 (void) {} diff --git a/gcc/testsuite/gcc.dg/weak/weak-10.c b/gcc/testsuite/gcc.dg/weak/weak-10.c new file mode 100644 index 00000000000..f39fbc4bbce --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-10.c @@ -0,0 +1,13 @@ +/* Test for #pragma weak where the weak alias symbol isn't declared, + although the symbol it is an alias for is defined in the + translation unit. Bug 7544. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +/* { dg-options "-fno-common" } */ + +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?bar1" } } */ + +#pragma weak bar1 = foo1 +void foo1 (void) {} diff --git a/gcc/testsuite/objc.dg/weak-1.m b/gcc/testsuite/objc.dg/weak-1.m new file mode 100644 index 00000000000..f39fbc4bbce --- /dev/null +++ b/gcc/testsuite/objc.dg/weak-1.m @@ -0,0 +1,13 @@ +/* Test for #pragma weak where the weak alias symbol isn't declared, + although the symbol it is an alias for is defined in the + translation unit. Bug 7544. */ +/* Origin: Joseph Myers <joseph@codesourcery.com> */ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +/* { dg-require-alias "" } */ +/* { dg-options "-fno-common" } */ + +/* { dg-final { scan-assembler "weak\[^ \t\]*\[ \t\]_?bar1" } } */ + +#pragma weak bar1 = foo1 +void foo1 (void) {} |