aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2009-07-25 20:09:42 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2009-07-25 20:09:42 +0200
commit86631ea3dd78a0077a6f96061affe89d5e38220f (patch)
tree3c96ae42a6ff9f1334a7b02a1bd9e7eff55129ad /gcc/c-common.c
parent2a9de349388c25eb2d8df725d5eace68c6c2c81d (diff)
downloadgcc-86631ea3dd78a0077a6f96061affe89d5e38220f.zip
gcc-86631ea3dd78a0077a6f96061affe89d5e38220f.tar.gz
gcc-86631ea3dd78a0077a6f96061affe89d5e38220f.tar.bz2
extend.texi (Labels as Values): Document need for noclone.
2009-07-25 Martin Jambor <mjambor@suse.cz> * doc/extend.texi (Labels as Values): Document need for noclone. (Function Attributes): Document noclone attribute. * c-common.c (c_common_attribute_table): New element for noclone. (handle_noclone_attribute): New function. Forward-declare. * tree-inline.c (tree_versionable_function_p): Check for noclone attribute. * testsuite/gcc.c-torture/execute/pr17377.c: Add noclone attribute to function y. * testsuite/gcc.dg/ipa/noclone-1.c: New test. From-SVN: r150086
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index aaa6435..0ebb9f1 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -482,6 +482,7 @@ static tree handle_noreturn_attribute (tree *, tree, tree, int, bool *);
static tree handle_hot_attribute (tree *, tree, tree, int, bool *);
static tree handle_cold_attribute (tree *, tree, tree, int, bool *);
static tree handle_noinline_attribute (tree *, tree, tree, int, bool *);
+static tree handle_noclone_attribute (tree *, tree, tree, int, bool *);
static tree handle_always_inline_attribute (tree *, tree, tree, int,
bool *);
static tree handle_gnu_inline_attribute (tree *, tree, tree, int, bool *);
@@ -733,6 +734,8 @@ const struct attribute_spec c_common_attribute_table[] =
handle_noreturn_attribute },
{ "noinline", 0, 0, true, false, false,
handle_noinline_attribute },
+ { "noclone", 0, 0, true, false, false,
+ handle_noclone_attribute },
{ "always_inline", 0, 0, true, false, false,
handle_always_inline_attribute },
{ "gnu_inline", 0, 0, true, false, false,
@@ -5913,6 +5916,23 @@ handle_noinline_attribute (tree *node, tree name,
return NULL_TREE;
}
+/* Handle a "noclone" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_noclone_attribute (tree *node, tree name,
+ tree ARG_UNUSED (args),
+ int ARG_UNUSED (flags), bool *no_add_attrs)
+{
+ if (TREE_CODE (*node) != FUNCTION_DECL)
+ {
+ warning (OPT_Wattributes, "%qE attribute ignored", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "always_inline" attribute; arguments as in
struct attribute_spec.handler. */