diff options
author | Alexey Neyman <alex.neyman@auriga.ru> | 2005-03-08 13:19:40 +0000 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2005-03-08 05:19:40 -0800 |
commit | 6e9a32219ba643ca53c2b68822f0eddbf3280503 (patch) | |
tree | cdc25a73277e939285d67c67cd208d1cd34a0bc2 /gcc/c-common.c | |
parent | 25d8d27de5150007e26f4cb3397b823af63c5344 (diff) | |
download | gcc-6e9a32219ba643ca53c2b68822f0eddbf3280503.zip gcc-6e9a32219ba643ca53c2b68822f0eddbf3280503.tar.gz gcc-6e9a32219ba643ca53c2b68822f0eddbf3280503.tar.bz2 |
re PR c/14411 (Request for setjmp/longjmp attributes)
PR c/14411
* calls.c (flags_from_decl_or_type): Handle eturns_twice' attribute.
* c-common.c (handle_returns_twice): New function.
(c_common_attribute_table): Declare eturns_twice' attribute.
* doc/extend.texi: Document eturns_twice' attribute.
* tree.h (DECL_IS_RETURNS_TWICE): New macro.
(struct tree_decl): Add returns_twice_flag.
From-SVN: r96101
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 39868e8..313af75 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -537,6 +537,7 @@ static tree handle_tls_model_attribute (tree *, tree, tree, int, static tree handle_no_instrument_function_attribute (tree *, tree, tree, int, bool *); static tree handle_malloc_attribute (tree *, tree, tree, int, bool *); +static tree handle_returns_twice_attribute (tree *, tree, tree, int, bool *); static tree handle_no_limit_stack_attribute (tree *, tree, tree, int, bool *); static tree handle_pure_attribute (tree *, tree, tree, int, bool *); @@ -607,6 +608,8 @@ const struct attribute_spec c_common_attribute_table[] = handle_no_instrument_function_attribute }, { "malloc", 0, 0, true, false, false, handle_malloc_attribute }, + { "returns_twice", 0, 0, true, false, false, + handle_returns_twice_attribute }, { "no_stack_limit", 0, 0, true, false, false, handle_no_limit_stack_attribute }, { "pure", 0, 0, true, false, false, @@ -4787,6 +4790,24 @@ handle_malloc_attribute (tree *node, tree name, tree ARG_UNUSED (args), return NULL_TREE; } +/* Handle a "returns_twice" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_returns_twice_attribute (tree *node, tree name, tree ARG_UNUSED (args), + int ARG_UNUSED (flags), bool *no_add_attrs) +{ + if (TREE_CODE (*node) == FUNCTION_DECL) + DECL_IS_RETURNS_TWICE (*node) = 1; + else + { + warning ("%qs attribute ignored", IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + } + + return NULL_TREE; +} + /* Handle a "no_limit_stack" attribute; arguments as in struct attribute_spec.handler. */ |