OSDN Git Service

* unwind-dw2-fde.c (__deregister_frame_info_bases):
[pf3gnuchains/gcc-fork.git] / gcc / attribs.c
index 29982de..a20ff35 100644 (file)
@@ -49,6 +49,10 @@ static tree handle_common_attribute  PARAMS ((tree *, tree, tree, int,
                                                 bool *));
 static tree handle_noreturn_attribute  PARAMS ((tree *, tree, tree, int,
                                                 bool *));
+static tree handle_noinline_attribute  PARAMS ((tree *, tree, tree, int,
+                                                bool *));
+static tree handle_used_attribute      PARAMS ((tree *, tree, tree, int,
+                                                bool *));
 static tree handle_unused_attribute    PARAMS ((tree *, tree, tree, int,
                                                 bool *));
 static tree handle_const_attribute     PARAMS ((tree *, tree, tree, int,
@@ -100,6 +104,10 @@ static const struct attribute_spec c_common_attribute_table[] =
                              handle_noreturn_attribute },
   { "volatile",               0, 0, true,  false, false,
                              handle_noreturn_attribute },
+  { "noinline",               0, 0, true,  false, false,
+                             handle_noinline_attribute },
+  { "used",                   0, 0, true,  false, false,
+                             handle_used_attribute },
   { "unused",                 0, 0, false, false, false,
                              handle_unused_attribute },
   /* The same comments as for noreturn attributes apply to const ones.  */
@@ -244,7 +252,7 @@ init_attributes ()
    a decl attribute to the declaration rather than to its type).  If
    ATTR_FLAG_BUILT_IN is not set and *NODE is a DECL, then also consider
    whether there might be some default attributes to apply to this DECL;
-   if so, decl_attributes will be called recusrively with those attributes
+   if so, decl_attributes will be called recursively with those attributes
    and ATTR_FLAG_BUILT_IN set.  */
 
 tree
@@ -509,6 +517,51 @@ handle_noreturn_attribute (node, name, args, flags, no_add_attrs)
   return NULL_TREE;
 }
 
+/* Handle a "noinline" attribute; arguments as in
+   struct attribute_spec.handler.  */
+
+static tree
+handle_noinline_attribute (node, name, args, flags, no_add_attrs)
+     tree *node;
+     tree name;
+     tree args ATTRIBUTE_UNUSED;
+     int flags ATTRIBUTE_UNUSED;
+     bool *no_add_attrs;
+{
+  if (TREE_CODE (*node) == FUNCTION_DECL)
+    DECL_UNINLINABLE (*node) = 1;
+  else
+    {
+      warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+      *no_add_attrs = true;
+    }
+
+  return NULL_TREE;
+}
+
+/* Handle a "used" attribute; arguments as in
+   struct attribute_spec.handler.  */
+
+static tree
+handle_used_attribute (node, name, args, flags, no_add_attrs)
+     tree *node;
+     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;
+  else
+    {
+      warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
+      *no_add_attrs = true;
+    }
+
+  return NULL_TREE;
+}
+
 /* Handle a "unused" attribute; arguments as in
    struct attribute_spec.handler.  */