]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
(enum attrs): Add A_UNUSED.
authorRichard Kenner <kenner@gcc.gnu.org>
Sun, 30 Apr 1995 11:13:38 +0000 (07:13 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 30 Apr 1995 11:13:38 +0000 (07:13 -0400)
(init_attributes): Initialize it.
(decl_attributes, case A_UNUSED): New case.

From-SVN: r9545

gcc/c-common.c

index 4c4e317bc2e30778e9b21adbb94afd87b6e1ec25..0bdde5c7b54f9e570003f11e12e99fc43d1ad6e7 100644 (file)
@@ -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;