aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@gcc.gnu.org>2003-02-18 18:07:06 -0800
committerRichard Henderson <rth@gcc.gnu.org>2003-02-18 18:07:06 -0800
commitd7ddbe241a953a4ba9adae1f3a38ade24f9121f0 (patch)
tree61bfc9f2c849a8b517a22fb036bb9ba1c8838f72 /gcc/c-common.c
parent05e9e0a570f2a0d9f1d683b4cb543ba556d6a1a6 (diff)
downloadgcc-d7ddbe241a953a4ba9adae1f3a38ade24f9121f0.zip
gcc-d7ddbe241a953a4ba9adae1f3a38ade24f9121f0.tar.gz
gcc-d7ddbe241a953a4ba9adae1f3a38ade24f9121f0.tar.bz2
c-common.c (handle_used_attribute): Accept static data too.
* c-common.c (handle_used_attribute): Accept static data too. * gcc.dg/attr-invalid.c: Allow __used__ on static data. * gcc.dg/attr-used-2.c: New. From-SVN: r63082
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index c78692f..b49dc25 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5415,16 +5415,19 @@ handle_always_inline_attribute (node, name, args, flags, no_add_attrs)
struct attribute_spec.handler. */
static tree
-handle_used_attribute (node, name, args, flags, no_add_attrs)
- tree *node;
+handle_used_attribute (pnode, name, args, flags, no_add_attrs)
+ tree *pnode;
tree name;
tree args ATTRIBUTE_UNUSED;
int flags ATTRIBUTE_UNUSED;
bool *no_add_attrs;
{
- if (TREE_CODE (*node) == FUNCTION_DECL)
- TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (*node))
- = TREE_USED (*node) = 1;
+ tree node = *pnode;
+
+ if (TREE_CODE (node) == FUNCTION_DECL
+ || (TREE_CODE (node) == VAR_DECL && TREE_STATIC (node)))
+ TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (node))
+ = TREE_USED (node) = 1;
else
{
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));