From 86f029aa95092540cbd4e96f70371960b3a90e7f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Mon, 29 Nov 2004 18:54:06 +0000 Subject: [multiple changes] 2004-11-29 Daniel Jacobowitz 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 * Make-lang.in (cp/decl2.o): Update dependencies. * decl2.c (finish_file): Call maybe_apply_pending_pragma_weaks. objc: 2004-11-29 Joseph Myers * 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 * g++.dg/ext/weak1.C, gcc.dg/weak/weak-10.c, objc.dg/weak-1.m: New tests. From-SVN: r91479 --- gcc/c-pragma.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'gcc/c-pragma.c') diff --git a/gcc/c-pragma.c b/gcc/c-pragma.c index 91efc4a..cc1dd28 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 -- cgit v1.1