From 7d3b509adae17f526dad2929ae2b16183408401d Mon Sep 17 00:00:00 2001 From: jsm28 Date: Tue, 2 Oct 2001 07:12:25 +0000 Subject: * 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 --- gcc/tree.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'gcc/tree.h') diff --git a/gcc/tree.h b/gcc/tree.h index d4306a88eda..efa0b83c684 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2140,7 +2140,11 @@ enum attribute_flags ATTR_FLAG_ARRAY_NEXT = 4, /* The type passed in is a structure, union or enumeration type being created, and should be modified in place. */ - ATTR_FLAG_TYPE_IN_PLACE = 8 + ATTR_FLAG_TYPE_IN_PLACE = 8, + /* The attributes are being applied by default to a library function whose + name indicates known behavior, and should be silently ignored if they + are not in fact compatible with the function type. */ + ATTR_FLAG_BUILT_IN = 16 }; /* Default versions of target-overridable functions. */ @@ -2920,6 +2924,13 @@ extern int setjmp_call_p PARAMS ((tree)); a decl attribute to the declaration rather than to its type). */ extern tree decl_attributes PARAMS ((tree *, tree, int)); +/* The following function must be provided by front ends + using attribs.c. */ + +/* Possibly apply default attributes to a function (represented by + a FUNCTION_DECL). */ +extern void insert_default_attributes PARAMS ((tree)); + /* Table of machine-independent attributes for checking formats, if used. */ extern const struct attribute_spec *format_attribute_table; -- cgit v1.2.1