aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-03-27 16:34:55 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-03-27 16:34:55 +0000
commit6b4e94bcaef89af9899da67f2dffc54496120535 (patch)
tree80c072ec99b03af1c2177a37fdaa302f07d39aa2 /gcc/c-common.c
parent62bc00e258331aeba39f47e9fee275f4ba5b7956 (diff)
downloadgcc-6b4e94bcaef89af9899da67f2dffc54496120535.zip
gcc-6b4e94bcaef89af9899da67f2dffc54496120535.tar.gz
gcc-6b4e94bcaef89af9899da67f2dffc54496120535.tar.bz2
re PR c/32511 (GCC rejects inline+weak function)
2008-03-27 Richard Guenther <rguenther@suse.de> PR c/32511 * c-common.c (handle_weak_attribute): Reject combination of weak and inline. * gcc.dg/attr-weak-1.c: New testcase. From-SVN: r133646
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1b62974..7e609de 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5518,11 +5518,16 @@ handle_weak_attribute (tree *node, tree name,
bool * ARG_UNUSED (no_add_attrs))
{
if (TREE_CODE (*node) == FUNCTION_DECL
- || TREE_CODE (*node) == VAR_DECL)
+ && DECL_DECLARED_INLINE_P (*node))
+ {
+ error ("inline function %q+D cannot be declared weak", *node);
+ *no_add_attrs = true;
+ }
+ else if (TREE_CODE (*node) == FUNCTION_DECL
+ || TREE_CODE (*node) == VAR_DECL)
declare_weak (*node);
else
warning (OPT_Wattributes, "%qE attribute ignored", name);
-
return NULL_TREE;
}