diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ee5f70b97b25feb405ad1b17b76445b50b5beb74..60a391c45ec5088cb6885a9cbf4e777f567289c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,31 @@ +2003-08-04 Roger Sayle <roger@eyesopen.com> + + * c-common.c (flag_noniso_default_format_attributes): Delete. + (built_in_attribute): Don't define/undefine DEF_FN_ATTR. + (c_attrs_initialized): Delete. + (c_common_nodes_and_builtins): Don't test c_attrs_initialized, + always call c_init_attributes. + (c_init_attributes): Don't define/undefine DEF_FN_ATTR. Don't + set c_attrs_initialized when done. + (c_common_insert_default_attributes): Delete. + * c-common.h (flag_noniso_default_format_attributes): Delete. + (c_coomon_insert_default_attributes): Delete prototype. + * c-opts.c (set_std_c89, set_std_c99, set_std_cxx98): Dont set + flag_noniso_default_format_attributes. + + * c-decl.c (c_insert_default_attributes): Delete. + * c-tree.h (c_insert_default_attributes): Delete prototype. + + * attribs.c (decl_attributes): Don't call insert_default_attributes + langhook. Update function description comment. + * langhooks.h (lang_hooks): Remove insert_default_attributes field. + * langhooks-def.h (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Delete. + * c-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Don't define. + * system.h: Poison LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES macro. + + * objc/objc-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Don't + define. + 2003-08-04 Richard Sandiford <rsandif@redhat.com> * config/mips/mips.c (override_options): Disable -G on targets that diff --git a/gcc/attribs.c b/gcc/attribs.c index 6ddacb18348571010976ebaf2ac143b4d367b3e9..38a4308bdaaed4cad48f075f2ff2181b98437fbc 100644 --- a/gcc/attribs.c +++ b/gcc/attribs.c @@ -134,11 +134,7 @@ init_attributes (void) 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). 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 recursively with those attributes - and ATTR_FLAG_BUILT_IN set. */ + a decl attribute to the declaration rather than to its type). */ tree decl_attributes (tree *node, tree attributes, int flags) @@ -151,10 +147,6 @@ decl_attributes (tree *node, tree attributes, int flags) (*targetm.insert_attributes) (*node, &attributes); - if (DECL_P (*node) && TREE_CODE (*node) == FUNCTION_DECL - && !(flags & (int) ATTR_FLAG_BUILT_IN)) - (*lang_hooks.insert_default_attributes) (*node); - for (a = attributes; a; a = TREE_CHAIN (a)) { tree name = TREE_PURPOSE (a); diff --git a/gcc/c-common.c b/gcc/c-common.c index 5dc87d78849bb4798554e9b609ca52dd663b597a..60e980f62ecfcd07baf47d29f7448527db46d5e2 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -372,11 +372,6 @@ int flag_isoc99; int flag_hosted = 1; -/* Nonzero means add default format_arg attributes for functions not - in ISO C. */ - -int flag_noniso_default_format_attributes = 1; - /* Nonzero means warn when casting a function call to a type that does not match the return type (e.g. (float)sqrt() or (anything*)malloc() when there is no previous declaration of sqrt or malloc. */ @@ -2957,20 +2952,16 @@ enum built_in_attribute #define DEF_ATTR_INT(ENUM, VALUE) ENUM, #define DEF_ATTR_IDENT(ENUM, STRING) ENUM, #define DEF_ATTR_TREE_LIST(ENUM, PURPOSE, VALUE, CHAIN) ENUM, -#define DEF_FN_ATTR(NAME, ATTRS, PREDICATE) /* No entry needed in enum. */ #include "builtin-attrs.def" #undef DEF_ATTR_NULL_TREE #undef DEF_ATTR_INT #undef DEF_ATTR_IDENT #undef DEF_ATTR_TREE_LIST -#undef DEF_FN_ATTR ATTR_LAST }; static GTY(()) tree built_in_attributes[(int) ATTR_LAST]; -static bool c_attrs_initialized = false; - static void c_init_attributes (void); /* Build tree nodes and builtin functions common to both C and C++ language @@ -3348,8 +3339,7 @@ c_common_nodes_and_builtins (void) #undef DEF_FUNCTION_TYPE_VAR_3 #undef DEF_POINTER_TYPE - if (!c_attrs_initialized) - c_init_attributes (); + c_init_attributes (); #define DEF_BUILTIN(ENUM, NAME, CLASS, TYPE, LIBTYPE, \ BOTH_P, FALLBACK_P, NONANSI_P, ATTRS, IMPLICIT) \ @@ -4176,21 +4166,11 @@ c_init_attributes (void) = tree_cons (built_in_attributes[(int) PURPOSE], \ built_in_attributes[(int) VALUE], \ built_in_attributes[(int) CHAIN]); -#define DEF_FN_ATTR(NAME, ATTRS, PREDICATE) /* No initialization needed. */ #include "builtin-attrs.def" #undef DEF_ATTR_NULL_TREE #undef DEF_ATTR_INT #undef DEF_ATTR_IDENT #undef DEF_ATTR_TREE_LIST -#undef DEF_FN_ATTR - c_attrs_initialized = true; -} - -/* Depending on the name of DECL, apply default attributes to it. */ - -void -c_common_insert_default_attributes (tree decl ATTRIBUTE_UNUSED) -{ } /* Output a -Wshadow warning MSGCODE about NAME, and give the location diff --git a/gcc/c-common.h b/gcc/c-common.h index da673f62da1d2a7b45c779a5daec1f828eee8872..9be6dfecabe8d391b7cc0223cb719a54c46d36ea 100644 --- a/gcc/c-common.h +++ b/gcc/c-common.h @@ -549,11 +549,6 @@ extern int flag_isoc99; extern int flag_hosted; -/* Nonzero means add default format_arg attributes for functions not - in ISO C. */ - -extern int flag_noniso_default_format_attributes; - /* Nonzero means warn when casting a function call to a type that does not match the return type (e.g. (float)sqrt() or (anything*)malloc() when there is no previous declaration of sqrt or malloc. */ @@ -893,7 +888,6 @@ extern void check_function_format (int *, tree, tree); extern void set_Wformat (int); extern tree handle_format_attribute (tree *, tree, tree, int, bool *); extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *); -extern void c_common_insert_default_attributes (tree); extern int c_common_handle_option (size_t code, const char *arg, int value); extern bool c_common_missing_argument (const char *opt, size_t code); extern tree c_common_type_for_mode (enum machine_mode, int); diff --git a/gcc/c-decl.c b/gcc/c-decl.c index cfe1a8e8db59d2500736161158bc84dce9d05b77..550d6c83880db8539ad6a8721225f232c381e3ee 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -2370,17 +2370,6 @@ builtin_function (const char *name, tree type, int function_code, return decl; } - -/* Apply default attributes to a function, if a system function with default - attributes. */ - -void -c_insert_default_attributes (tree decl) -{ - if (!TREE_PUBLIC (decl)) - return; - c_common_insert_default_attributes (decl); -} /* Called when a declaration is seen that contains no names to declare. If its type is a reference to a structure, union or enum inherited diff --git a/gcc/c-lang.c b/gcc/c-lang.c index fb729f326b9ce78d2cd4b802a4839c0e81d05cd6..d998e19727819c8353cab5165380015d266ac766 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -61,8 +61,6 @@ enum c_language_kind c_language = clk_c; #define LANG_HOOKS_PARSE_FILE c_common_parse_file #undef LANG_HOOKS_TRUTHVALUE_CONVERSION #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion -#undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES -#define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES c_insert_default_attributes #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl #undef LANG_HOOKS_UNSAFE_FOR_REEVAL diff --git a/gcc/c-opts.c b/gcc/c-opts.c index e1922cb9bcb94ed61b35ff83b493a1afa311980a..012f24ba53a8a9bfeedd74d82489e325c9427d4f 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -1459,7 +1459,6 @@ set_std_c89 (int c94, int iso) flag_no_asm = iso; flag_no_gnu_keywords = iso; flag_no_nonansi_builtin = iso; - flag_noniso_default_format_attributes = !iso; flag_isoc94 = c94; flag_isoc99 = 0; flag_writable_strings = 0; @@ -1472,7 +1471,6 @@ set_std_c99 (int iso) cpp_set_lang (parse_in, iso ? CLK_STDC99: CLK_GNUC99); flag_no_asm = iso; flag_no_nonansi_builtin = iso; - flag_noniso_default_format_attributes = !iso; flag_iso = iso; flag_isoc99 = 1; flag_isoc94 = 1; @@ -1486,7 +1484,6 @@ set_std_cxx98 (int iso) cpp_set_lang (parse_in, iso ? CLK_CXX98: CLK_GNUCXX); flag_no_gnu_keywords = iso; flag_no_nonansi_builtin = iso; - flag_noniso_default_format_attributes = !iso; flag_iso = iso; } diff --git a/gcc/c-tree.h b/gcc/c-tree.h index f2f27de6ac3da53a2dcdb7cb8bf859549e636ebd..afcd04224f64ed9f34d793f44ea7ed7defe35635 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -186,7 +186,6 @@ extern void insert_block (tree); extern void set_block (tree); extern tree pushdecl (tree); -extern void c_insert_default_attributes (tree); extern void c_init_decl_processing (void); extern void c_dup_lang_specific_decl (tree); extern void c_print_identifier (FILE *, tree, int); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a8c8a97b1c5e7e77b227e911827a2eefde77d316..737a97caa528e48812d145c61d588e18beaaa25e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2003-08-04 Roger Sayle <roger@eyesopen.com> + + * decl.c (cxx_insert_default_attributes): Delete. + * cp-tree.h (cxx_insert_default_attributes): Don't prototype. + * cp-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Don't define. + 2003-08-03 Nathan Sidwell <nathan@codesourcery.com> PR c++/11704 diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 6de92102a9db754268b66478c534990d1ac70453..ab0d305b2aaef4a08dfba07eb947a9d670e36d37 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -77,8 +77,6 @@ static bool cp_var_mod_type_p (tree); #define LANG_HOOKS_MAYBE_BUILD_CLEANUP cxx_maybe_build_cleanup #undef LANG_HOOKS_TRUTHVALUE_CONVERSION #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion -#undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES -#define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES cxx_insert_default_attributes #undef LANG_HOOKS_UNSAFE_FOR_REEVAL #define LANG_HOOKS_UNSAFE_FOR_REEVAL c_common_unsafe_for_reeval #undef LANG_HOOKS_SET_DECL_ASSEMBLER_NAME diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 1e84a53d0b86798569edb7d7abdcad413f1415fb..ffae1bfc66fa7aba05140b87292808c4f22376d8 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3638,7 +3638,6 @@ extern tree pushdecl (tree); extern void cxx_init_decl_processing (void); enum cp_tree_node_structure_enum cp_tree_node_structure (union lang_tree_node *); -extern void cxx_insert_default_attributes (tree); extern bool cxx_mark_addressable (tree); extern void cxx_push_function_context (struct function *); extern void cxx_pop_function_context (struct function *); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ab6913cc0c81ae584645612d49b7a6e7d70417bc..6bd5c86a198861aa3923f95d981d05114249d4c9 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -6642,19 +6642,6 @@ push_throw_library_fn (tree name, tree type) TREE_NOTHROW (fn) = 0; return fn; } - -/* Apply default attributes to a function, if a system function with default - attributes. */ - -void -cxx_insert_default_attributes (tree decl) -{ - if (!DECL_EXTERN_C_FUNCTION_P (decl)) - return; - if (!TREE_PUBLIC (decl)) - return; - c_common_insert_default_attributes (decl); -} /* When we call finish_struct for an anonymous union, we create default copy constructors and such. But, an anonymous union diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index 47e8b7209af6372dc1b9d654f7c0386d5da07258..478553b5d322a4cee27eac817e500c12dc0999cf 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -99,7 +99,6 @@ extern void lhd_initialize_diagnostics (struct diagnostic_context *); #define LANG_HOOKS_FINISH_INCOMPLETE_DECL lhd_do_nothing_t #define LANG_HOOKS_UNSAFE_FOR_REEVAL lhd_unsafe_for_reeval #define LANG_HOOKS_STATICP lhd_staticp -#define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES lhd_do_nothing_t #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL lhd_do_nothing_t #define LANG_HOOKS_UNSAVE_EXPR_NOW lhd_unsave_expr_now #define LANG_HOOKS_MAYBE_BUILD_CLEANUP lhd_return_null_tree @@ -259,7 +258,6 @@ extern int lhd_tree_dump_type_quals (tree); LANG_HOOKS_EXPAND_CONSTANT, \ LANG_HOOKS_EXPAND_EXPR, \ LANG_HOOKS_TRUTHVALUE_CONVERSION, \ - LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES, \ LANG_HOOKS_SAFE_FROM_P, \ LANG_HOOKS_FINISH_INCOMPLETE_DECL, \ LANG_HOOKS_UNSAFE_FOR_REEVAL, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index fbdaadc61cad899bb41494dc1f5adf8f532b41f0..4ac0250164ce15a35cde26418d4c73caa8ea9c9d 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -272,10 +272,6 @@ struct lang_hooks error_mark_node). */ tree (*truthvalue_conversion) (tree); - /* Possibly apply default attributes to a function (represented by - a FUNCTION_DECL). */ - void (*insert_default_attributes) (tree); - /* Hook called by safe_from_p for language-specific tree codes. It is up to the language front-end to install a hook if it has any such codes that safe_from_p needs to know about. Since same_from_p will diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 1700fb0ceee52a23d19a87d3f8eda85dfe6bbef9..eda8c5dd19cff1b063b7c367edf84d263953fc64 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -61,8 +61,6 @@ enum c_language_kind c_language = clk_objc; #define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable #undef LANG_HOOKS_TRUTHVALUE_CONVERSION #define LANG_HOOKS_TRUTHVALUE_CONVERSION c_common_truthvalue_conversion -#undef LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES -#define LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES c_insert_default_attributes #undef LANG_HOOKS_FINISH_INCOMPLETE_DECL #define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl #undef LANG_HOOKS_UNSAFE_FOR_REEVAL diff --git a/gcc/system.h b/gcc/system.h index a0117c579be288593801b6148525644849e27a9b..aae0dda56fde12d583b57e37d1be26a359e23592 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -614,7 +614,7 @@ typedef char _Bool; /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \ - LANG_HOOKS_MARK_TREE + LANG_HOOKS_MARK_TREE LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES /* Libiberty macros that are no longer used in GCC. */ #undef ANSI_PROTOTYPES