aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2006-08-15 21:46:30 +0000
committerDanny Smith <dannysmith@gcc.gnu.org>2006-08-15 21:46:30 +0000
commit55af93a8a3f04d7a1953fafba7d7e169754cb863 (patch)
tree211877abcbf327a83cb6b5734399fa9e50c8c349 /gcc/c-common.c
parentc1782c0e69d219d3ccceeca553a3d1d90622d1af (diff)
downloadgcc-55af93a8a3f04d7a1953fafba7d7e169754cb863.zip
gcc-55af93a8a3f04d7a1953fafba7d7e169754cb863.tar.gz
gcc-55af93a8a3f04d7a1953fafba7d7e169754cb863.tar.bz2
re PR c/28287 (ICE with misplaced attribute weak)
gcc PR c/28287 * c-common.c (handle_weak_attribute): Ignore and warn if not a FUNCTION_ or VAR_DECL testsuite * gcc.dg/attr-invalid.c: Add tests for invalid weak attribute. From-SVN: r116170
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 58c48d8..167d04b 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -4737,12 +4737,17 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
struct attribute_spec.handler. */
static tree
-handle_weak_attribute (tree *node, tree ARG_UNUSED (name),
+handle_weak_attribute (tree *node, tree name,
tree ARG_UNUSED (args),
int ARG_UNUSED (flags),
bool * ARG_UNUSED (no_add_attrs))
{
- declare_weak (*node);
+ 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;
}