From: Eric Botcazou Date: Mon, 6 Jun 2016 09:51:33 +0000 (+0000) Subject: utils.c (gnat_internal_attribute_table): Add support for noinline and noclone attributes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1f0b1322e0f2233122f67a86c3181f08c633e06c;p=gcc.git utils.c (gnat_internal_attribute_table): Add support for noinline and noclone attributes. * gcc-interface/utils.c (gnat_internal_attribute_table): Add support for noinline and noclone attributes. (handle_noinline_attribute): New handler. (handle_noclone_attribute): Likewise. From-SVN: r237127 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 115d7079ee8..92292bea058 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2016-06-06 Eric Botcazou + + * gcc-interface/utils.c (gnat_internal_attribute_table): Add support + for noinline and noclone attributes. + (handle_noinline_attribute): New handler. + (handle_noclone_attribute): Likewise. + 2016-06-06 Eric Botcazou * gcc-interface/trans.c (process_type): Beef up comment. diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 6a55796a442..831b6e035aa 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -90,6 +90,8 @@ static tree handle_novops_attribute (tree *, tree, tree, int, bool *); static tree handle_nonnull_attribute (tree *, tree, tree, int, bool *); static tree handle_sentinel_attribute (tree *, tree, tree, int, bool *); static tree handle_noreturn_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_leaf_attribute (tree *, tree, tree, int, bool *); static tree handle_always_inline_attribute (tree *, tree, tree, int, bool *); static tree handle_malloc_attribute (tree *, tree, tree, int, bool *); @@ -121,6 +123,10 @@ const struct attribute_spec gnat_internal_attribute_table[] = false }, { "noreturn", 0, 0, true, false, false, handle_noreturn_attribute, false }, + { "noinline", 0, 0, true, false, false, handle_noinline_attribute, + false }, + { "noclone", 0, 0, true, false, false, handle_noclone_attribute, + false }, { "leaf", 0, 0, true, false, false, handle_leaf_attribute, false }, { "always_inline",0, 0, true, false, false, handle_always_inline_attribute, @@ -5963,6 +5969,51 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args), return NULL_TREE; } +/* Handle a "noinline" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_noinline_attribute (tree *node, tree name, + tree ARG_UNUSED (args), + int ARG_UNUSED (flags), bool *no_add_attrs) +{ + if (TREE_CODE (*node) == FUNCTION_DECL) + { + if (lookup_attribute ("always_inline", DECL_ATTRIBUTES (*node))) + { + warning (OPT_Wattributes, "%qE attribute ignored due to conflict " + "with attribute %qs", name, "always_inline"); + *no_add_attrs = true; + } + else + DECL_UNINLINABLE (*node) = 1; + } + else + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } + + 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 "leaf" attribute; arguments as in struct attribute_spec.handler. */