diff options
author | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-02 07:12:25 +0000 |
---|---|---|
committer | jsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-02 07:12:25 +0000 |
commit | 7d3b509adae17f526dad2929ae2b16183408401d (patch) | |
tree | 4648d58efabadc87677da26b0f516d5bfc64f45c /gcc/attribs.c | |
parent | 7c2404e186a146b9f3c028fed4742d3abc302d1b (diff) | |
download | gcc-7d3b509adae17f526dad2929ae2b16183408401d.tar.gz |
* attribs.c (decl_attributes): Possibly call
insert_default_attributes to insert default attributes on
functions in a lazy manner.
* builtin-attrs.def: New file; define the default format and
format_arg attributes.
* c-common.c (c_format_attribute_table): Move to earlier in the
file.
(c_common_nodes_and_builtins): Initialize format_attribute_table.
(enum built_in_attribute, built_in_attributes,
c_attrs_initialized, c_init_attributes,
c_common_insert_default_attributes): New.
(c_common_lang_init): Don't initialize format_attribute_table. Do
call c_init_attributes.
* Makefile.in (c-common.o): Depend on builtin-attrs.def.
* c-common.h (init_function_format_info): Don't declare.
(c_common_insert_default_attributes): Declare.
* c-decl.c (implicitly_declare, builtin_function): Call
decl_attributes.
(init_decl_processing): Don't call init_function_format_info.
(insert_default_attributes): New.
* c-format.c (handle_format_attribute,
handle_format_arg_attribute): Be quiet about inappropriate
declaration when applying default attributes.
(init_function_format_info): Remove.
* tree.h (enum attribute_flags): Add ATTR_FLAG_BUILT_IN.
(insert_default_attributes): Declare.
cp:
* decl.c (init_decl_processing): Don't call
init_function_format_info. Initialize lang_attribute_table
earlier.
(builtin_function): Call decl_attributes.
(insert_default_attributes): New.
testsuite:
* gcc.dg/format/attr-5.c, gcc.dg/format/attr-6.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r-- | gcc/attribs.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c index 1413dc267f9..29982dec529 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -241,7 +241,11 @@ init_attributes () information, in the form of a bitwise OR of flags in enum attribute_flags from tree.h. Depending on these flags, some attributes may be returned to be applied at a later stage (for example, to apply - a decl attribute to the declaration rather than to its type). */ + a decl attribute to the declaration rather than to its type). If + ATTR_FLAG_BUILT_IN is not set and *NODE is a DECL, then also consider + whether there might be some default attributes to apply to this DECL; + if so, decl_attributes will be called recusrively with those attributes + and ATTR_FLAG_BUILT_IN set. */ tree decl_attributes (node, attributes, flags) @@ -256,6 +260,10 @@ decl_attributes (node, attributes, flags) (*targetm.insert_attributes) (*node, &attributes); + if (DECL_P (*node) && TREE_CODE (*node) == FUNCTION_DECL + && !(flags & (int) ATTR_FLAG_BUILT_IN)) + insert_default_attributes (*node); + for (a = attributes; a; a = TREE_CHAIN (a)) { tree name = TREE_PURPOSE (a); |