diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 834bdffecb5..347905c48da 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2002-03-26 Neil Booth + + * Makefile.in (ggc-common.o): Update. + * c-decl.c (lang_mark_tree): Rename c_mark_tree. + * c-lang.c (LANG_HOOKS_MARK_TREE): Redefine. + * c-tree.h (c_mark_tree): New. + * ggc-common.c: Include langhooks.h. + (gcc_mark_trees): Use new langhook. + * ggc-callbacks.c: Delete file. + * ggc.h (lang_mark_tree): Remove. + * langhooks-def.h (LANG_HOOKS_MARK_TREE): New. + (LANG_HOOKS_INITIALIZER): Update. + * langhooks.h (struct lang_hooks): New hook. +objc: + * objc-lang.c (LANG_HOOKS_MARK_TREE): Redefine. + 2002-03-25 Zack Weinberg * doc/cpp.texi: Exclude entire Top node from printed manual. diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 7078ca39351..0603e261b04 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -1296,7 +1296,7 @@ dumpvers: dumpvers.c version.o: version.c version.h ggc-common.o: ggc-common.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) \ - flags.h $(GGC_H) varray.h hash.h $(HASHTAB_H) $(TM_P_H) + flags.h $(GGC_H) varray.h hash.h $(HASHTAB_H) $(TM_P_H) langhooks.h ggc-simple.o: ggc-simple.c $(CONFIG_H) $(SYSTEM_H) $(RTL_H) $(TREE_H) flags.h \ $(GGC_H) varray.h $(TIMEVAR_H) $(TM_P_H) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ecba441a129..b1147851d40 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2002-03-26 Neil Booth + + * misc.c (LANG_HOOKS_MARK_TREE): Redefine. + (lang_mark_tree): Make static, rename. + 2002-03-25 Neil Booth * misc.c (maybe_build_cleanup): Remove. diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index b32ba1fad97..3ae66a83f98 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -86,6 +86,7 @@ static const char *gnat_printable_name PARAMS ((tree, int)); static tree gnat_eh_runtime_type PARAMS ((tree)); static int gnat_eh_type_covers PARAMS ((tree, tree)); static void gnat_parse_file PARAMS ((void)); +static void gnat_mark_tree PARAMS ((tree)); /* Structure giving our language-specific hooks. */ @@ -101,6 +102,8 @@ static void gnat_parse_file PARAMS ((void)); #define LANG_HOOKS_DECODE_OPTION gnat_decode_option #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE gnat_parse_file +#undef LANG_HOOKS_MARK_TREE +#define LANG_HOOKS_MARK_TREE gnat_mark_tree #undef LANG_HOOKS_HONOR_READONLY #define LANG_HOOKS_HONOR_READONLY 1 #undef LANG_HOOKS_GET_ALIAS_SET @@ -271,8 +274,8 @@ gnat_init_options () gnat_argc = 1; } -void -lang_mark_tree (t) +static void +gnat_mark_tree (t) tree t; { switch (TREE_CODE (t)) diff --git a/gcc/c-decl.c b/gcc/c-decl.c index 6008b936e4a..e1d104d4fc9 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -7149,7 +7149,7 @@ c_dup_lang_specific_decl (decl) /* Mark the language specific bits in T for GC. */ void -lang_mark_tree (t) +c_mark_tree (t) tree t; { if (TREE_CODE (t) == IDENTIFIER_NODE) diff --git a/gcc/c-lang.c b/gcc/c-lang.c index 325ebd5d15d..5bdd743d967 100644 --- a/gcc/c-lang.c +++ b/gcc/c-lang.c @@ -50,6 +50,8 @@ static void c_post_options PARAMS ((void)); #define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set #undef LANG_HOOKS_SAFE_FROM_P #define LANG_HOOKS_SAFE_FROM_P c_safe_from_p +#undef LANG_HOOKS_MARK_TREE +#define LANG_HOOKS_MARK_TREE c_mark_tree #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE c_common_parse_file #undef LANG_HOOKS_STATICP diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 8ce73aa48a5..ad2d88df228 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -178,6 +178,7 @@ extern tree pushdecl PARAMS ((tree)); extern void c_init_decl_processing PARAMS ((void)); extern void c_dup_lang_specific_decl PARAMS ((tree)); extern void c_print_identifier PARAMS ((FILE *, tree, int)); +extern void c_mark_tree PARAMS ((tree)); extern tree build_array_declarator PARAMS ((tree, tree, int, int)); extern tree build_enumerator PARAMS ((tree, tree)); extern int c_decode_option PARAMS ((int, char **)); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 15063def74f..870a697bcb6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2002-03-26 Neil Booth + + * cp-lang.c (LANG_HOOKS_MARK_TREE): Redefine. + * cp-tree.h (cxx_mark_tree): New. + * decl.c (lang_mark_tree): Rename cxx_mark_tree. + 2002-03-25 Neil Booth * cp-tree.h (cxx_maybe_build_cleanup): New. diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c index 29f34410cbd..f198b5ec026 100644 --- a/gcc/cp/cp-lang.c +++ b/gcc/cp/cp-lang.c @@ -59,6 +59,8 @@ static bool ok_to_generate_alias_set_for_type PARAMS ((tree)); #define LANG_HOOKS_UNSAVE_EXPR_NOW cxx_unsave_expr_now #undef LANG_HOOKS_MAYBE_BUILD_CLEANUP #define LANG_HOOKS_MAYBE_BUILD_CLEANUP cxx_maybe_build_cleanup +#undef LANG_HOOKS_MARK_TREE +#define LANG_HOOKS_MARK_TREE cxx_mark_tree #undef LANG_HOOKS_PRINT_STATISTICS #define LANG_HOOKS_PRINT_STATISTICS cxx_print_statistics #undef LANG_HOOKS_PRINT_XNODE diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 3a7ccc4c54b..244b01ec1ef 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -3668,6 +3668,7 @@ extern void insert_block PARAMS ((tree)); extern void set_block PARAMS ((tree)); extern tree pushdecl PARAMS ((tree)); extern void cxx_init_decl_processing PARAMS ((void)); +extern void cxx_mark_tree PARAMS ((tree)); extern int toplevel_bindings_p PARAMS ((void)); extern int namespace_bindings_p PARAMS ((void)); extern void keep_next_level PARAMS ((int)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index c739c9e30c4..208370793f4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -14624,7 +14624,7 @@ mark_cp_function_context (f) } void -lang_mark_tree (t) +cxx_mark_tree (t) tree t; { enum tree_code code = TREE_CODE (t); diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index b2000193f72..da22c002ca5 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,8 @@ +Tue Mar 26 07:30:51 2002 Neil Booth + + * com.c (LANG_HOOKS_MARK_TREE): Redefine. + (lang_mark_tree): Rename ffe_mark_tree, make static. + Mon Mar 25 19:27:11 2002 Neil Booth * com.c (maybe_build_cleanup): Remove. diff --git a/gcc/f/com.c b/gcc/f/com.c index 084519b32e6..a2b2e09d1e3 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -14205,6 +14205,7 @@ static const char *ffe_init PARAMS ((const char *)); static void ffe_finish PARAMS ((void)); static void ffe_init_options PARAMS ((void)); static void ffe_print_identifier PARAMS ((FILE *, tree, int)); +static void ffe_mark_tree (tree); #undef LANG_HOOKS_NAME #define LANG_HOOKS_NAME "GNU F77" @@ -14218,6 +14219,8 @@ static void ffe_print_identifier PARAMS ((FILE *, tree, int)); #define LANG_HOOKS_DECODE_OPTION ffe_decode_option #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE ffe_parse_file +#undef LANG_HOOKS_MARK_TREE +#define LANG_HOOKS_MARK_TREE ffe_mark_tree #undef LANG_HOOKS_PRINT_IDENTIFIER #define LANG_HOOKS_PRINT_IDENTIFIER ffe_print_identifier #undef LANG_HOOKS_DECL_PRINTABLE_NAME @@ -15126,9 +15129,9 @@ unsigned_type (type) return type; } -void -lang_mark_tree (t) - union tree_node *t ATTRIBUTE_UNUSED; +static void +ffe_mark_tree (t) + tree t; { if (TREE_CODE (t) == IDENTIFIER_NODE) { diff --git a/gcc/ggc-callbacks.c b/gcc/ggc-callbacks.c deleted file mode 100644 index f831923ee58..00000000000 --- a/gcc/ggc-callbacks.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Empty GC callbacks to be used by languages that don't support GC. - Copyright (C) 1999, 2000 Free Software Foundation, Inc. - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - GCC is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING. If not, write to the Free - Software Foundation, 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#include "config.h" -#include "system.h" -#include "rtl.h" -#include "tree.h" -#include "tm_p.h" -#include "ggc.h" - -void ATTRIBUTE_NORETURN -lang_mark_tree (t) - union tree_node *t ATTRIBUTE_UNUSED; -{ - /* If this function is called, we are doing GC. But, this file is - only included in compilers for languages that don't support GC. */ - abort (); -} - diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c index 77614ff8b5b..9c7b46d2b8b 100644 --- a/gcc/ggc-common.c +++ b/gcc/ggc-common.c @@ -30,6 +30,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "hashtab.h" #include "varray.h" #include "ggc.h" +#include "langhooks.h" /* Statistics about the allocation. */ static ggc_statistics *ggc_stats; @@ -436,7 +437,7 @@ ggc_mark_trees () break; case IDENTIFIER_NODE: - lang_mark_tree (t); + (*lang_hooks.mark_tree) (t); continue; default: @@ -470,7 +471,7 @@ ggc_mark_trees () if (DECL_SAVED_INSNS (t)) ggc_mark_struct_function (DECL_SAVED_INSNS (t)); } - lang_mark_tree (t); + (*lang_hooks.mark_tree) (t); break; case 't': /* A type node. */ @@ -487,7 +488,7 @@ ggc_mark_trees () ggc_mark_tree (TYPE_MAIN_VARIANT (t)); ggc_mark_tree (TYPE_BINFO (t)); ggc_mark_tree (TYPE_CONTEXT (t)); - lang_mark_tree (t); + (*lang_hooks.mark_tree) (t); break; case 'b': /* A lexical block. */ @@ -518,7 +519,7 @@ ggc_mark_trees () } case 'x': - lang_mark_tree (t); + (*lang_hooks.mark_tree) (t); break; } } diff --git a/gcc/ggc.h b/gcc/ggc.h index ae021fc203a..8d65b12a2a5 100644 --- a/gcc/ggc.h +++ b/gcc/ggc.h @@ -179,10 +179,6 @@ extern int ggc_marked_p PARAMS ((const void *)); /* Callbacks to the languages. */ -/* This is the language's opportunity to mark nodes held through - the lang_specific hooks in the tree. */ -extern void lang_mark_tree PARAMS ((union tree_node *)); - /* The FALSE_LABEL_STACK, declared in except.h, has language-dependent semantics. If a front-end needs to mark the false label stack, it should set this pointer to a non-NULL value. Otherwise, no marking diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index cb18fc596d6..1605e212458 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2002-03-26 Neil Booth + + * decl.c (lang_mark_tree): Rename java_mark_tree. + * java-tree.h (java_mark_tree): New. + * java-lang.c (LANG_HOOKS_MARK_TREE): Redefine. + 2002-03-25 Zack Weinberg * lex.c: Change java_perform_atof to take normal parameters diff --git a/gcc/java/decl.c b/gcc/java/decl.c index a84269d09f9..a0a77b26d9b 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1835,7 +1835,7 @@ end_java_method () /* Mark language-specific parts of T for garbage-collection. */ void -lang_mark_tree (t) +java_mark_tree (t) tree t; { if (TREE_CODE (t) == IDENTIFIER_NODE) diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index 5fde938b663..de7b1025152 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -1038,6 +1038,7 @@ struct lang_type extern void java_set_yydebug PARAMS ((int)); extern void java_parse_file PARAMS ((void)); +extern void java_mark_tree PARAMS ((tree)); extern void add_assume_compiled PARAMS ((const char *, int)); extern tree lookup_class PARAMS ((tree)); extern tree lookup_java_constructor PARAMS ((tree, tree)); diff --git a/gcc/java/lang.c b/gcc/java/lang.c index c612b491b4a..99a5e20037c 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -223,6 +223,8 @@ static int dependency_tracking = 0; #define LANG_HOOKS_SET_YYDEBUG java_set_yydebug #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE java_parse_file +#undef LANG_HOOKS_MARK_TREE +#define LANG_HOOKS_MARK_TREE java_mark_tree #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL #define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL java_dup_lang_specific_decl #undef LANG_HOOKS_DECL_PRINTABLE_NAME diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index fa840a6c591..57c792be959 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -83,6 +83,7 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree)); #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 +#define LANG_HOOKS_MARK_TREE lhd_do_nothing_t #define LANG_HOOKS_HONOR_READONLY false #define LANG_HOOKS_PRINT_STATISTICS lhd_do_nothing #define LANG_HOOKS_PRINT_XNODE lhd_print_tree_nothing @@ -178,6 +179,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree)); LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \ LANG_HOOKS_UNSAVE_EXPR_NOW, \ LANG_HOOKS_MAYBE_BUILD_CLEANUP, \ + LANG_HOOKS_MARK_TREE, \ LANG_HOOKS_HONOR_READONLY, \ LANG_HOOKS_PRINT_STATISTICS, \ LANG_HOOKS_PRINT_XNODE, \ diff --git a/gcc/langhooks.h b/gcc/langhooks.h index d13d518e48b..73a7628a1d5 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -184,6 +184,9 @@ struct lang_hooks for the passed TARGET_EXPR. Return NULL if there is none. */ tree (*maybe_build_cleanup) PARAMS ((tree)); + /* Mark nodes held through the lang_specific hooks in the tree. */ + void (*mark_tree) PARAMS ((tree)); + /* Nonzero if TYPE_READONLY and TREE_READONLY should always be honored. */ bool honor_readonly; diff --git a/gcc/objc/objc-lang.c b/gcc/objc/objc-lang.c index 2be19df9523..aa22ea316a3 100644 --- a/gcc/objc/objc-lang.c +++ b/gcc/objc/objc-lang.c @@ -46,6 +46,8 @@ static void objc_post_options PARAMS ((void)); #define LANG_HOOKS_POST_OPTIONS objc_post_options #undef LANG_HOOKS_PARSE_FILE #define LANG_HOOKS_PARSE_FILE c_common_parse_file +#undef LANG_HOOKS_MARK_TREE +#define LANG_HOOKS_MARK_TREE c_mark_tree #undef LANG_HOOKS_STATICP #define LANG_HOOKS_STATICP c_staticp #undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL