From e6ca6782acfa8b126c6abb6bcd9026572217525d Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Tue, 28 May 2019 07:23:54 +0000 Subject: [PATCH] utils.c (gnat_internal_attribute_table): Add support for stack_protect attribute. * gcc-interface/utils.c (gnat_internal_attribute_table): Add support for stack_protect attribute. (handle_stack_protect_attribute): New static function. From-SVN: r271680 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/gcc-interface/utils.c | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 377b13e0ecc..6acef36fbf0 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-05-28 Eric Botcazou + + * gcc-interface/utils.c (gnat_internal_attribute_table): Add support + for stack_protect attribute. + (handle_stack_protect_attribute): New static function. + 2019-05-28 Eric Botcazou * gcc-interface/decl.c (intrin_arglists_compatible_p): Do not return diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 4d3facca55a..d090d0954ac 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -90,6 +90,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_stack_protect_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 *); @@ -123,6 +124,8 @@ const struct attribute_spec gnat_internal_attribute_table[] = handle_sentinel_attribute, NULL }, { "noreturn", 0, 0, true, false, false, false, handle_noreturn_attribute, NULL }, + { "stack_protect",0, 0, true, false, false, false, + handle_stack_protect_attribute, NULL }, { "noinline", 0, 0, true, false, false, false, handle_noinline_attribute, NULL }, { "noclone", 0, 0, true, false, false, false, @@ -6357,6 +6360,22 @@ handle_noinline_attribute (tree *node, tree name, return NULL_TREE; } +/* Handle a "stack_protect" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_stack_protect_attribute (tree *node, tree name, tree, int, + 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 "noclone" attribute; arguments as in struct attribute_spec.handler. */ -- 2.30.2