From: Richard Kenner Date: Sun, 30 Apr 1995 11:13:38 +0000 (-0400) Subject: (enum attrs): Add A_UNUSED. X-Git-Tag: misc/cutover-egcs-0~4413 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1c4fadec3712890f734ae74347f2abe3436455cb;p=thirdparty%2Fgcc.git (enum attrs): Add A_UNUSED. (init_attributes): Initialize it. (decl_attributes, case A_UNUSED): New case. From-SVN: r9545 --- diff --git a/gcc/c-common.c b/gcc/c-common.c index 4c4e317bc2e3..0bdde5c7b54f 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;