aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-04-30 07:13:38 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-04-30 07:13:38 -0400
commit1c4fadec3712890f734ae74347f2abe3436455cb (patch)
treee995ab257de405bab0c228c069a270e1ffa361e7 /gcc/c-common.c
parent9727936469cd5e40eebf2b14b69a0ce376acc673 (diff)
downloadgcc-1c4fadec3712890f734ae74347f2abe3436455cb.zip
gcc-1c4fadec3712890f734ae74347f2abe3436455cb.tar.gz
gcc-1c4fadec3712890f734ae74347f2abe3436455cb.tar.bz2
(enum attrs): Add A_UNUSED.
(init_attributes): Initialize it. (decl_attributes, case A_UNUSED): New case. From-SVN: r9545
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 4c4e317..0bdde5c 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -30,7 +30,7 @@ extern struct obstack permanent_obstack;
enum attrs {A_PACKED, A_NOCOMMON, A_NORETURN, A_CONST, A_T_UNION,
A_CONSTRUCTOR, A_DESTRUCTOR, A_MODE, A_SECTION, A_ALIGNED,
- A_FORMAT, A_WEAK, A_ALIAS};
+ A_UNUSED, A_FORMAT, A_WEAK, A_ALIAS};
static void declare_hidden_char_array PROTO((char *, char *));
static void add_attribute PROTO((enum attrs, char *,
@@ -250,6 +250,7 @@ init_attributes ()
add_attribute (A_NOCOMMON, "nocommon", 0, 0, 1);
add_attribute (A_NORETURN, "noreturn", 0, 0, 1);
add_attribute (A_NORETURN, "volatile", 0, 0, 1);
+ add_attribute (A_UNUSED, "unused", 0, 0, 1);
add_attribute (A_CONST, "const", 0, 0, 1);
add_attribute (A_T_UNION, "transparent_union", 0, 0, 0);
add_attribute (A_CONSTRUCTOR, "constructor", 0, 0, 1);
@@ -355,6 +356,14 @@ decl_attributes (node, attributes, prefix_attributes)
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
break;
+ case A_UNUSED:
+ if (TREE_CODE (decl) == PARM_DECL || TREE_CODE (decl) == VAR_DECL
+ || TREE_CODE (decl) == FUNCTION_DECL)
+ TREE_USED (decl) = 1;
+ else
+ warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+ break;
+
case A_CONST:
if (TREE_CODE (decl) == FUNCTION_DECL)
TREE_READONLY (decl) = 1;