From c88770e9dfa1b4c4175e39a3a62264c8bcb0043b Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Mon, 25 Mar 2002 19:11:13 +0000 Subject: [PATCH] c-decl.c (maybe_build_cleanup): Remove. * c-decl.c (maybe_build_cleanup): Remove. * expr.c (expand_expr): Use langhook. * langhooks-def.h (lhd_return_null_tree, LANG_HOOKS_MAYBE_BUILD_CLEANUP): New. (LANGHOOKS_INITIALIZER): Update. * langhooks.c (lhd_return_null_tree): New. * langhooks.h (struct lang_hooks): New hook. * tree-inline.c (initialize_inlined_parameters): Use langhook. * tree.h (maybe_build_cleanup): Remove. ada: * misc.c (maybe_build_cleanup): Remove. cp: * cp-tree.h (cxx_maybe_build_cleanup): New. * decl.c (destroy_local_var, hack_incomplete_structures): Update. (maybe_build_cleanup): Rename cxx_maybe_build_cleanup. * tree.c (build_target_expr): Update. f: * com.c (maybe_build_cleanup): Remove. java: * decl.c (maybe_build_cleanup): Remove. From-SVN: r51324 --- gcc/ChangeLog | 12 ++++++++++++ gcc/ada/ChangeLog | 4 ++++ gcc/ada/misc.c | 12 ------------ gcc/c-decl.c | 11 ----------- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/cp-tree.h | 1 + gcc/cp/decl.c | 6 +++--- gcc/cp/tree.c | 2 +- gcc/expr.c | 3 ++- gcc/f/ChangeLog | 4 ++++ gcc/f/com.c | 11 ----------- gcc/java/ChangeLog | 4 ++++ gcc/java/decl.c | 11 ----------- gcc/langhooks-def.h | 3 +++ gcc/langhooks.c | 9 +++++++++ gcc/langhooks.h | 4 ++++ gcc/tree-inline.c | 2 +- gcc/tree.h | 6 ------ 18 files changed, 55 insertions(+), 57 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c0bbf018a9c..ee9a97fcf07 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2002-03-25 Neil Booth + + * c-decl.c (maybe_build_cleanup): Remove. + * expr.c (expand_expr): Use langhook. + * langhooks-def.h (lhd_return_null_tree, + LANG_HOOKS_MAYBE_BUILD_CLEANUP): New. + (LANGHOOKS_INITIALIZER): Update. + * langhooks.c (lhd_return_null_tree): New. + * langhooks.h (struct lang_hooks): New hook. + * tree-inline.c (initialize_inlined_parameters): Use langhook. + * tree.h (maybe_build_cleanup): Remove. + 2002-03-25 Jakub Jelinek * regrename.c (build_def_use): Move recog_memoized diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 72d47752074..ecba441a129 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2002-03-25 Neil Booth + + * misc.c (maybe_build_cleanup): Remove. + 2002-03-24 Neil Booth * gigi.h (yyparse): Remove. diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c index 7073c8969f0..b32ba1fad97 100644 --- a/gcc/ada/misc.c +++ b/gcc/ada/misc.c @@ -406,18 +406,6 @@ gnat_init_gcc_eh () #endif } - -/* If DECL has a cleanup, build and return that cleanup here. - This is a callback called by expand_expr. */ - -tree -maybe_build_cleanup (decl) - tree decl ATTRIBUTE_UNUSED; -{ - /* There are no cleanups in C. */ - return NULL_TREE; -} - /* Hooks for print-tree.c: */ static void diff --git a/gcc/c-decl.c b/gcc/c-decl.c index a727b2707dd..6008b936e4a 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -3657,17 +3657,6 @@ finish_decl (decl, init, asmspec_tree) get_pending_sizes (); } -/* If DECL has a cleanup, build and return that cleanup here. - This is a callback called by expand_expr. */ - -tree -maybe_build_cleanup (decl) - tree decl ATTRIBUTE_UNUSED; -{ - /* There are no cleanups in C. */ - return NULL_TREE; -} - /* Given a parsed parameter declaration, decode it into a PARM_DECL and push that on the current binding level. Also, for the sake of forward parm decls, diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index df1bd5718ef..8c662709d56 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2002-03-25 Neil Booth + + * cp-tree.h (cxx_maybe_build_cleanup): New. + * decl.c (destroy_local_var, hack_incomplete_structures): Update. + (maybe_build_cleanup): Rename cxx_maybe_build_cleanup. + * tree.c (build_target_expr): Update. + 2002-03-24 Neil Booth * decl2.c (cxx_decode_option): Handle -E. diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index f213f7bf2ea..3a7ccc4c54b 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -4241,6 +4241,7 @@ extern void end_input PARAMS ((void)); /* in tree.c */ extern tree stabilize_expr PARAMS ((tree, tree *)); extern tree cxx_unsave_expr_now PARAMS ((tree)); +extern tree cxx_maybe_build_cleanup PARAMS ((tree)); extern void init_tree PARAMS ((void)); extern int pod_type_p PARAMS ((tree)); extern tree canonical_type_variant PARAMS ((tree)); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 9a3a0530725..c739c9e30c4 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8034,7 +8034,7 @@ destroy_local_var (decl) return; /* Compute the cleanup. */ - cleanup = maybe_build_cleanup (decl); + cleanup = cxx_maybe_build_cleanup (decl); /* Record the cleanup required for this declaration. */ if (DECL_SIZE (decl) && cleanup) @@ -14451,7 +14451,7 @@ hack_incomplete_structures (type) { tree cleanup; expand_decl (decl); - cleanup = maybe_build_cleanup (decl); + cleanup = cxx_maybe_build_cleanup (decl); expand_decl_init (decl); if (! expand_decl_cleanup (decl, cleanup)) error ("parser lost in parsing declaration of `%D'", @@ -14479,7 +14479,7 @@ hack_incomplete_structures (type) here. */ tree -maybe_build_cleanup (decl) +cxx_maybe_build_cleanup (decl) tree decl; { tree type = TREE_TYPE (decl); diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 4f1b168d7ca..2cc78a75aaf 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -234,7 +234,7 @@ build_target_expr (decl, value) tree t; t = build (TARGET_EXPR, TREE_TYPE (decl), decl, value, - maybe_build_cleanup (decl), NULL_TREE); + cxx_maybe_build_cleanup (decl), NULL_TREE); /* We always set TREE_SIDE_EFFECTS so that expand_expr does not ignore the TARGET_EXPR. If there really turn out to be no side-effects, then the optimizer should be able to get rid of diff --git a/gcc/expr.c b/gcc/expr.c index e6821d5f28f..bc8b6a94a76 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8379,7 +8379,8 @@ expand_expr (exp, target, tmode, modifier) built here. */ if (TREE_OPERAND (exp, 2) == 0) - TREE_OPERAND (exp, 2) = maybe_build_cleanup (slot); + TREE_OPERAND (exp, 2) + = (*lang_hooks.maybe_build_cleanup) (slot); cleanups = TREE_OPERAND (exp, 2); } } diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 2f0f678389d..b2000193f72 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,7 @@ +Mon Mar 25 19:27:11 2002 Neil Booth + + * com.c (maybe_build_cleanup): Remove. + 2002-03-23 Toon Moene * com.c (ffecom_check_size_overflow_): Add a test diff --git a/gcc/f/com.c b/gcc/f/com.c index f698ae9e3cf..084519b32e6 100644 --- a/gcc/f/com.c +++ b/gcc/f/com.c @@ -14381,17 +14381,6 @@ mark_addressable (exp) } } -/* If DECL has a cleanup, build and return that cleanup here. - This is a callback called by expand_expr. */ - -tree -maybe_build_cleanup (decl) - tree decl UNUSED; -{ - /* There are no cleanups in Fortran. */ - return NULL_TREE; -} - /* Exit a binding level. Pop the level off, and restore the state of the identifier-decl mappings that were in effect when this level was entered. diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index d43075c3c2c..64e8479f880 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2002-03-25 Neil Booth + + * decl.c (maybe_build_cleanup): Remove. + 2002-03-22 Tom Tromey Andrew Haley diff --git a/gcc/java/decl.c b/gcc/java/decl.c index ffcccb28229..a84269d09f9 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1565,17 +1565,6 @@ java_dup_lang_specific_decl (node) DECL_LANG_SPECIFIC (node) = x; } -/* If DECL has a cleanup, build and return that cleanup here. - This is a callback called by expand_expr. */ - -tree -maybe_build_cleanup (decl) - tree decl ATTRIBUTE_UNUSED; -{ - /* There are no cleanups in Java (I think). */ - return NULL_TREE; -} - void give_name_to_locals (jcf) JCF *jcf; diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h index f70963e9ebf..fa840a6c591 100644 --- a/gcc/langhooks-def.h +++ b/gcc/langhooks-def.h @@ -42,6 +42,7 @@ extern void lhd_do_nothing_t PARAMS ((tree)); extern int lhd_decode_option PARAMS ((int, char **)); extern HOST_WIDE_INT lhd_get_alias_set PARAMS ((tree)); extern tree lhd_return_tree PARAMS ((tree)); +extern tree lhd_return_null_tree PARAMS ((tree)); extern int lhd_safe_from_p PARAMS ((rtx, tree)); extern int lhd_staticp PARAMS ((tree)); extern void lhd_clear_binding_stack PARAMS ((void)); @@ -81,6 +82,7 @@ tree lhd_tree_inlining_convert_parm_for_inlining PARAMS ((tree, tree, tree)); #define LANG_HOOKS_STATICP lhd_staticp #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_HONOR_READONLY false #define LANG_HOOKS_PRINT_STATISTICS lhd_do_nothing #define LANG_HOOKS_PRINT_XNODE lhd_print_tree_nothing @@ -175,6 +177,7 @@ int lhd_tree_dump_type_quals PARAMS ((tree)); LANG_HOOKS_STATICP, \ LANG_HOOKS_DUP_LANG_SPECIFIC_DECL, \ LANG_HOOKS_UNSAVE_EXPR_NOW, \ + LANG_HOOKS_MAYBE_BUILD_CLEANUP, \ LANG_HOOKS_HONOR_READONLY, \ LANG_HOOKS_PRINT_STATISTICS, \ LANG_HOOKS_PRINT_XNODE, \ diff --git a/gcc/langhooks.c b/gcc/langhooks.c index 4c4d7d6f120..4bbcd5e148f 100644 --- a/gcc/langhooks.c +++ b/gcc/langhooks.c @@ -56,6 +56,15 @@ lhd_return_tree (t) return t; } +/* Do nothing (return NULL_TREE). */ + +tree +lhd_return_null_tree (t) + tree t ATTRIBUTE_UNUSED; +{ + return NULL_TREE; +} + /* Do nothing; the default hook to decode an option. */ int diff --git a/gcc/langhooks.h b/gcc/langhooks.h index d2a3e482ad8..d13d518e48b 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -180,6 +180,10 @@ struct lang_hooks things are cleared out. */ tree (*unsave_expr_now) PARAMS ((tree)); + /* Called by expand_expr to build and return the cleanup-expression + for the passed TARGET_EXPR. Return NULL if there is none. */ + tree (*maybe_build_cleanup) PARAMS ((tree)); + /* Nonzero if TYPE_READONLY and TREE_READONLY should always be honored. */ bool honor_readonly; diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 46ea052fb82..b255ee04338 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -562,7 +562,7 @@ initialize_inlined_parameters (id, args, fn) } /* See if we need to clean up the declaration. */ - cleanup = maybe_build_cleanup (var); + cleanup = (*lang_hooks.maybe_build_cleanup) (var); if (cleanup) { tree cleanup_stmt; diff --git a/gcc/tree.h b/gcc/tree.h index 04e12763efe..3018f2a4490 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2641,12 +2641,6 @@ extern tree unsigned_type PARAMS ((tree)); extern tree signed_type PARAMS ((tree)); -/* This function must be defined in the language-specific files. - expand_expr calls it to build the cleanup-expression for a TARGET_EXPR. - This is defined in a language-specific file. */ - -extern tree maybe_build_cleanup PARAMS ((tree)); - /* Given an expression EXP that may be a COMPONENT_REF or an ARRAY_REF, look for nested component-refs or array-refs at constant positions and find the ultimate containing object, which is returned. */