diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-18 18:29:02 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-18 18:29:02 +0000 |
commit | 93f10b04ca36ad37324d33de23650fc0f053683b (patch) | |
tree | ba59c40e9652d1cafe3687880cd7a3e173e06791 /gcc/attribs.c | |
parent | 5955c361a00431fa8809f8da0d214362ae647abf (diff) | |
download | gcc-93f10b04ca36ad37324d33de23650fc0f053683b.tar.gz |
* attribs.c (handle_noinline_attribute): New function.
(handle_used_attribute): Likewise.
(c_common_attribute_table): Added noinline and used.
* doc/extend.texi (Function Attributes): Document them.
* c-decl.c (duplicate_decls): Propagate DECL_UNINLINABLE.
Warn when merging inline with attribute noinline.
(start_decl, start_function): Warn if inline and attribute
noinline appear in the same declaration.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r-- | gcc/attribs.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c index 29982dec529..3f8edcebd51 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -49,6 +49,10 @@ static tree handle_common_attribute PARAMS ((tree *, tree, tree, int, bool *)); static tree handle_noreturn_attribute PARAMS ((tree *, tree, tree, int, bool *)); +static tree handle_noinline_attribute PARAMS ((tree *, tree, tree, int, + bool *)); +static tree handle_used_attribute PARAMS ((tree *, tree, tree, int, + bool *)); static tree handle_unused_attribute PARAMS ((tree *, tree, tree, int, bool *)); static tree handle_const_attribute PARAMS ((tree *, tree, tree, int, @@ -100,6 +104,10 @@ static const struct attribute_spec c_common_attribute_table[] = handle_noreturn_attribute }, { "volatile", 0, 0, true, false, false, handle_noreturn_attribute }, + { "noinline", 0, 0, true, false, false, + handle_noinline_attribute }, + { "used", 0, 0, true, false, false, + handle_used_attribute }, { "unused", 0, 0, false, false, false, handle_unused_attribute }, /* The same comments as for noreturn attributes apply to const ones. */ @@ -509,6 +517,51 @@ handle_noreturn_attribute (node, name, args, flags, no_add_attrs) return NULL_TREE; } +/* Handle a "noinline" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_noinline_attribute (node, name, args, flags, no_add_attrs) + tree *node; + tree name; + tree args ATTRIBUTE_UNUSED; + int flags ATTRIBUTE_UNUSED; + bool *no_add_attrs; +{ + if (TREE_CODE (*node) == FUNCTION_DECL) + DECL_UNINLINABLE (*node) = 1; + else + { + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + } + + return NULL_TREE; +} + +/* Handle a "used" attribute; arguments as in + struct attribute_spec.handler. */ + +static tree +handle_used_attribute (node, name, args, flags, no_add_attrs) + tree *node; + tree name; + tree args ATTRIBUTE_UNUSED; + int flags ATTRIBUTE_UNUSED; + bool *no_add_attrs; +{ + if (TREE_CODE (*node) == FUNCTION_DECL) + TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (*node)) + = TREE_USED (*node) = 1; + else + { + warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); + *no_add_attrs = true; + } + + return NULL_TREE; +} + /* Handle a "unused" attribute; arguments as in struct attribute_spec.handler. */ |