summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-28 16:34:36 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-28 16:34:36 +0000
commit4a68fd3cf82cde5dbdbfed957eac66f9f78820ea (patch)
treedf17a1c6a564a87e23e89f03d7cabc50414014c4 /gcc/ada/gcc-interface/utils.c
parent83f4b93be171071920df6321140d217239f7c23e (diff)
downloadgcc-4a68fd3cf82cde5dbdbfed957eac66f9f78820ea.tar.gz
* builtin-attrs.def (ATTR_LEAF): New attribute.
(ATTR_NOVOPS_LEAF_LIST, ATTR_LEAF_LIST, ATTR_NOTHROW_LEAF_LIST, ATTR_CONST_NOTHROW_LEAF_LIST, ATTR_PURE_NOTHROW_LEAF_LIST, ATTR_PURE_NOTHROW_NOVOPS_LEAF_LIST, ATTR_NORETURN_NOTHROW_LEAF_LIST, ATTR_MALLOC_NOTHROW_LEAF_LIST, ATTR_SENTINEL_NOTHROW_LEAF_LIST, ATTR_NOTHROW_NONNULL_LEAF, ATTR_CONST_NOTHROW_NONNULL_LEAF, ATTR_CONST_NOTHROW_TYPEGENERIC_LEAF, ATTR_PURE_NOTHROW_NONNULL_LEAF, ATTR_MALLOC_NOTHROW_NONNULL_LEAF): New attribute lists. * sync-builtins.def: Annotate all builtins by leaf. * omp-builtins.def: Annotate all builtins by leaf. * builtins.def: Annotate relevant builtins with leaf attribute. (ATTR_MATHFN_ERRNO, ATTR_MATHFN_FPROUNDING, ATTR_MATHFN_FPROUNDING_ERRNO, ATTR_MATHFN_FPROUNDING_STORE): Make leaf. * gcc-interface/utils.c (handle_leaf_attribute): New function. (gnat_internal_attribute_tables): Add leaf. * lto-lang.c (handle_leaf_attribute): New function. (lto_attribute_tables): Add leaf. * f95-lang.c (gfc_define_builtin): Make leaf. (gfc_init_builtin_functions): Handle only ATTR_CONST_NOTHROW_LEAF_LIST and ATTR_NOTHROW_LEAF_LIST. (DEF_SYNC_BUILTIN): Check ATTR_CONST_NOTHROW_LEAF_LIST. (DEF_GOMP_BUILTIN): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164689 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 3fab92b0c1e..18ccb3bb391 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -87,6 +87,7 @@ 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_leaf_attribute (tree *, tree, tree, int, bool *);
static tree handle_malloc_attribute (tree *, tree, tree, int, bool *);
static tree handle_type_generic_attribute (tree *, tree, tree, int, bool *);
static tree handle_vector_size_attribute (tree *, tree, tree, int, bool *);
@@ -108,6 +109,7 @@ const struct attribute_spec gnat_internal_attribute_table[] =
{ "nonnull", 0, -1, false, true, true, handle_nonnull_attribute },
{ "sentinel", 0, 1, false, true, true, handle_sentinel_attribute },
{ "noreturn", 0, 0, true, false, false, handle_noreturn_attribute },
+ { "leaf", 0, 0, true, false, false, handle_leaf_attribute },
{ "malloc", 0, 0, true, false, false, handle_malloc_attribute },
{ "type generic", 0, 0, false, true, true, handle_type_generic_attribute },
@@ -5184,6 +5186,28 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args),
return NULL_TREE;
}
+/* Handle a "leaf" attribute; arguments as in
+ struct attribute_spec.handler. */
+
+static tree
+handle_leaf_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;
+ }
+ if (!TREE_PUBLIC (*node))
+ {
+ warning (OPT_Wattributes, "%qE attribute has no effect on unit local functions", name);
+ *no_add_attrs = true;
+ }
+
+ return NULL_TREE;
+}
+
/* Handle a "malloc" attribute; arguments as in
struct attribute_spec.handler. */