aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-pragma.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@gcc.gnu.org>2004-11-29 18:54:06 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2004-11-29 18:54:06 +0000
commit86f029aa95092540cbd4e96f70371960b3a90e7f (patch)
tree09efe121e3a286e0aae7308c8245228e8c339428 /gcc/c-pragma.c
parentb0c2dee9fbfb3ca4b768c17f14afcb89086c0eae (diff)
downloadgcc-86f029aa95092540cbd4e96f70371960b3a90e7f.zip
gcc-86f029aa95092540cbd4e96f70371960b3a90e7f.tar.gz
gcc-86f029aa95092540cbd4e96f70371960b3a90e7f.tar.bz2
[multiple changes]
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. From-SVN: r91479
Diffstat (limited to 'gcc/c-pragma.c')
-rw-r--r--gcc/c-pragma.c32
1 files changed, 32 insertions, 0 deletions
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