diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-07 19:58:29 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-05-07 19:58:29 +0000 |
commit | 1d2bb6555da06fdaae73c53f9aaa38a688e301cd (patch) | |
tree | 67d27c098a1229b2020c6d36424e17ce028e09da | |
parent | f09431f142f803a83ce9555eece5a4238f2be8a6 (diff) | |
download | gcc-1d2bb6555da06fdaae73c53f9aaa38a688e301cd.tar.gz |
2011-05-07 Eric Botcazou <ebotcazou@adacore.com>
* langhooks.h (lang_hooks_for_types): Change global_bindings_p's return
type to bool and adjust comment.
* fold-const.c (fold_range_test): Adjust call to global_bindings_p.
(fold_mathfn_compare): Remove calls to global_bindings_p.
(fold_inf_compare): Likewise.
* stor-layout.c (variable_size): Adjust call to global_bindings_p.
* c-tree.h (global_bindings_p): Adjust prototype.
* c-decl.c (global_bindings_p): Return bool and simplify.
ada/
* gcc-interface/gigi.h (global_bindings_p): Adjust prototype.
* gcc-interface/utils.c (global_bindings_p): Return bool and simplify.
cp/
* name-lookup.h (global_bindings_p): Adjust prototype.
* name-lookup.c (global_bindings_p): Return bool.
fortran/
* f95-lang.c (global_bindings_p): Return bool and simplify.
go/
* go-lang.c (global_bindings_p): Return bool and simplify.
java/
* java-tree.h (global_bindings_p): Adjust prototype.
* decl.c (global_bindings_p): Return bool.
lto/
* lto-lang.c (global_bindings_p): Return bool.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173535 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 11 | ||||
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/gigi.h | 4 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 6 | ||||
-rw-r--r-- | gcc/c-decl.c | 8 | ||||
-rw-r--r-- | gcc/c-tree.h | 2 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 4 | ||||
-rw-r--r-- | gcc/cp/name-lookup.h | 2 | ||||
-rw-r--r-- | gcc/fold-const.c | 25 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/fortran/f95-lang.c | 8 | ||||
-rw-r--r-- | gcc/go/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/go/go-lang.c | 6 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/java/decl.c | 4 | ||||
-rw-r--r-- | gcc/java/java-tree.h | 2 | ||||
-rw-r--r-- | gcc/langhooks.h | 7 | ||||
-rw-r--r-- | gcc/lto/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/lto/lto-lang.c | 6 | ||||
-rw-r--r-- | gcc/stor-layout.c | 8 |
21 files changed, 80 insertions, 53 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a3f6a111463..61b6bcd0048 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2011-05-07 Eric Botcazou <ebotcazou@adacore.com> + + * langhooks.h (lang_hooks_for_types): Change global_bindings_p's return + type to bool and adjust comment. + * fold-const.c (fold_range_test): Adjust call to global_bindings_p. + (fold_mathfn_compare): Remove calls to global_bindings_p. + (fold_inf_compare): Likewise. + * stor-layout.c (variable_size): Adjust call to global_bindings_p. + * c-tree.h (global_bindings_p): Adjust prototype. + * c-decl.c (global_bindings_p): Return bool and simplify. + 2011-05-07 Zdenek Dvorak <ook@ucw.cz> PR tree-optimization/48837 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 18c56d0af99..b13e734c809 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,7 +1,11 @@ +2011-05-07 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/gigi.h (global_bindings_p): Adjust prototype. + * gcc-interface/utils.c (global_bindings_p): Return bool and simplify. + 2011-05-05 Nathan Froyd <froydnj@codesourcery.com> - * gcc-interface/trans.c (Case_Statement_to_gnu): Call - build_case_label. + * gcc-interface/trans.c (Case_Statement_to_gnu): Call build_case_label. 2011-05-05 Nathan Froyd <froydnj@codesourcery.com> diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h index 8c69e751a33..c1f1217a594 100644 --- a/gcc/ada/gcc-interface/gigi.h +++ b/gcc/ada/gcc-interface/gigi.h @@ -422,8 +422,8 @@ extern GTY(()) tree gnat_raise_decls_ext[(int) LAST_REASON_CODE + 1]; /* Routines expected by the gcc back-end. They must have exactly the same prototype and names as below. */ -/* Returns nonzero if we are currently in the global binding level. */ -extern int global_bindings_p (void); +/* Return true if we are in the global binding level. */ +extern bool global_bindings_p (void); /* Enter and exit a new binding level. */ extern void gnat_pushlevel (void); diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 1703a8b89a8..cfa58b93997 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -365,12 +365,12 @@ build_dummy_unc_pointer_types (Entity_Id gnat_desig_type, tree gnu_desig_type) TYPE_OBJECT_RECORD_TYPE (gnu_desig_type) = gnu_object_type; } -/* Return nonzero if we are currently in the global binding level. */ +/* Return true if we are in the global binding level. */ -int +bool global_bindings_p (void) { - return ((force_global || !current_function_decl) ? -1 : 0); + return force_global || current_function_decl == NULL_TREE; } /* Enter a new binding level. */ diff --git a/gcc/c-decl.c b/gcc/c-decl.c index cea26052a9e..6e359a9f41e 100644 --- a/gcc/c-decl.c +++ b/gcc/c-decl.c @@ -845,14 +845,12 @@ objc_mark_locals_volatile (void *enclosing_blk) } } -/* Nonzero if we are currently in file scope. */ +/* Return true if we are in the global binding level. */ -int +bool global_bindings_p (void) { - return (current_scope == file_scope && !c_override_global_bindings_to_false - ? -1 - : 0); + return current_scope == file_scope && !c_override_global_bindings_to_false; } void diff --git a/gcc/c-tree.h b/gcc/c-tree.h index 97a4e55cd12..e2b42bf8317 100644 --- a/gcc/c-tree.h +++ b/gcc/c-tree.h @@ -413,7 +413,7 @@ extern struct obstack parser_obstack; extern tree c_break_label; extern tree c_cont_label; -extern int global_bindings_p (void); +extern bool global_bindings_p (void); extern void push_scope (void); extern tree pop_scope (void); extern void c_bindings_start_stmt_expr (struct c_spot_bindings *); diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 70c7f3e31a3..f56be1d5744 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-05-07 Eric Botcazou <ebotcazou@adacore.com> + + * name-lookup.h (global_bindings_p): Adjust prototype. + * name-lookup.c (global_bindings_p): Return bool. + 2011-05-06 Jason Merrill <jason@redhat.com> * decl.c (stabilize_save_expr_r): Set *walk_subtrees as diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index e1cf1cf0f1d..3d1c64d85cf 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -1576,9 +1576,9 @@ maybe_push_cleanup_level (tree type) } } -/* Nonzero if we are currently in the global binding level. */ +/* Return true if we are in the global binding level. */ -int +bool global_bindings_p (void) { return global_scope_p (current_binding_level); diff --git a/gcc/cp/name-lookup.h b/gcc/cp/name-lookup.h index bfcac69c110..4bf253f3680 100644 --- a/gcc/cp/name-lookup.h +++ b/gcc/cp/name-lookup.h @@ -290,7 +290,7 @@ extern GTY(()) tree global_type_node; extern cxx_scope *leave_scope (void); extern bool kept_level_p (void); -extern int global_bindings_p (void); +extern bool global_bindings_p (void); extern bool toplevel_bindings_p (void); extern bool namespace_bindings_p (void); extern bool template_parm_scope_p (void); diff --git a/gcc/fold-const.c b/gcc/fold-const.c index f7d4e5f05c9..a42921b6858 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4849,8 +4849,8 @@ fold_range_test (location_t loc, enum tree_code code, tree type, ? TRUTH_AND_EXPR : TRUTH_OR_EXPR, type, op0, op1); - else if (lang_hooks.decls.global_bindings_p () == 0 - && ! CONTAINS_PLACEHOLDER_P (lhs)) + else if (!lang_hooks.decls.global_bindings_p () + && !CONTAINS_PLACEHOLDER_P (lhs)) { tree common = save_expr (lhs); @@ -6148,10 +6148,6 @@ fold_mathfn_compare (location_t loc, build_real (TREE_TYPE (arg), dconst0)); /* sqrt(x) < y is x >= 0 && x != +Inf, when y is large. */ - if (lang_hooks.decls.global_bindings_p () != 0 - || CONTAINS_PLACEHOLDER_P (arg)) - return NULL_TREE; - arg = save_expr (arg); return fold_build2_loc (loc, TRUTH_ANDIF_EXPR, type, fold_build2_loc (loc, GE_EXPR, type, arg, @@ -6168,18 +6164,14 @@ fold_mathfn_compare (location_t loc, build_real (TREE_TYPE (arg), c2)); /* sqrt(x) < c is the same as x >= 0 && x < c*c. */ - if (lang_hooks.decls.global_bindings_p () == 0 - && ! CONTAINS_PLACEHOLDER_P (arg)) - { - arg = save_expr (arg); - return fold_build2_loc (loc, TRUTH_ANDIF_EXPR, type, + arg = save_expr (arg); + return fold_build2_loc (loc, TRUTH_ANDIF_EXPR, type, fold_build2_loc (loc, GE_EXPR, type, arg, build_real (TREE_TYPE (arg), dconst0)), fold_build2_loc (loc, code, type, arg, build_real (TREE_TYPE (arg), c2))); - } } } @@ -6226,13 +6218,8 @@ fold_inf_compare (location_t loc, enum tree_code code, tree type, return omit_one_operand_loc (loc, type, integer_one_node, arg0); /* x <= +Inf is the same as x == x, i.e. isfinite(x). */ - if (lang_hooks.decls.global_bindings_p () == 0 - && ! CONTAINS_PLACEHOLDER_P (arg0)) - { - arg0 = save_expr (arg0); - return fold_build2_loc (loc, EQ_EXPR, type, arg0, arg0); - } - break; + arg0 = save_expr (arg0); + return fold_build2_loc (loc, EQ_EXPR, type, arg0, arg0); case EQ_EXPR: case GE_EXPR: diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0a392c54412..162da2e5c98 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2011-05-07 Eric Botcazou <ebotcazou@adacore.com> + + * f95-lang.c (global_bindings_p): Return bool and simplify. + 2011-05-07 Tobias Burnus <burnus@net-b.de> PR fortran/18918 diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index eb38484ee33..e247d70a6c0 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -91,7 +91,7 @@ static void gfc_finish (void); static void gfc_write_global_declarations (void); static void gfc_print_identifier (FILE *, tree, int); void do_function_end (void); -int global_bindings_p (void); +bool global_bindings_p (void); static void clear_binding_stack (void); static void gfc_be_parse_file (void); static alias_set_type gfc_get_alias_set (tree); @@ -373,12 +373,12 @@ static GTY(()) struct binding_level *global_binding_level; static struct binding_level clear_binding_level = { NULL, NULL, NULL }; -/* Return nonzero if we are currently in the global binding level. */ +/* Return true if we are in the global binding level. */ -int +bool global_bindings_p (void) { - return current_binding_level == global_binding_level ? -1 : 0; + return current_binding_level == global_binding_level; } tree diff --git a/gcc/go/ChangeLog b/gcc/go/ChangeLog index 6df65976ccb..4136702481b 100644 --- a/gcc/go/ChangeLog +++ b/gcc/go/ChangeLog @@ -1,3 +1,7 @@ +2011-05-07 Eric Botcazou <ebotcazou@adacore.com> + + * go-lang.c (global_bindings_p): Return bool and simplify. + 2011-05-05 Nathan Froyd <froydnj@codesourcery.com> * go-gcc.cc (Gcc_backend::switch_statement): Call build_case_label. diff --git a/gcc/go/go-lang.c b/gcc/go/go-lang.c index 5132e97cfe3..84c7f8d1591 100644 --- a/gcc/go/go-lang.c +++ b/gcc/go/go-lang.c @@ -308,10 +308,12 @@ go_langhook_builtin_function (tree decl) return decl; } -static int +/* Return true if we are in the global binding level. */ + +static bool go_langhook_global_bindings_p (void) { - return current_function_decl == NULL ? 1 : 0; + return current_function_decl == NULL_TREE; } /* Push a declaration into the current binding level. We can't diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 7dea6e43f54..bdc0aa7bdaf 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2011-05-07 Eric Botcazou <ebotcazou@adacore.com> + + * java-tree.h (global_bindings_p): Adjust prototype. + * decl.c (global_bindings_p): Return bool. + 2011-05-05 Nathan Froyd <froydnj@codesourcery.com> * expr.c (expand_java_switch): Call build_case_label. diff --git a/gcc/java/decl.c b/gcc/java/decl.c index cb012485d00..47b4ebe8de9 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1302,9 +1302,9 @@ pushdecl_function_level (tree x) return t; } -/* Nonzero if we are currently in the global binding level. */ +/* Return true if we are in the global binding level. */ -int +bool global_bindings_p (void) { return current_binding_level == global_binding_level; diff --git a/gcc/java/java-tree.h b/gcc/java/java-tree.h index e422b4a1557..7743c6e5c82 100644 --- a/gcc/java/java-tree.h +++ b/gcc/java/java-tree.h @@ -983,7 +983,7 @@ extern tree ident_subst (const char *, int, const char *, int, int, const char *); extern tree identifier_subst (const tree, const char *, int, int, const char *); -extern int global_bindings_p (void); +extern bool global_bindings_p (void); extern tree getdecls (void); extern void pushlevel (int); extern tree poplevel (int,int, int); diff --git a/gcc/langhooks.h b/gcc/langhooks.h index e0dea01fc9a..89e74f93681 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -148,9 +148,10 @@ struct lang_hooks_for_types struct lang_hooks_for_decls { - /* Returns nonzero if we are in the global binding level. Ada - returns -1 for an undocumented reason used in stor-layout.c. */ - int (*global_bindings_p) (void); + /* Return true if we are in the global binding level. This hook is really + needed only if the language supports variable-sized types at the global + level, i.e. declared outside subprograms. */ + bool (*global_bindings_p) (void); /* Function to add a decl to the current scope level. Takes one argument, a decl to add. Returns that decl, or, if the same diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 61558e3fc4a..46779ff192b 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,7 @@ +2011-05-07 Eric Botcazou <ebotcazou@adacore.com> + + * lto-lang.c (global_bindings_p): Return bool. + 2011-05-07 Jan Hubicka <jh@suse.cz> * lto.c (lto_materialize_function): Use cgraph_function_with_gimple_body_p. diff --git a/gcc/lto/lto-lang.c b/gcc/lto/lto-lang.c index c65d916c14c..5872928be0d 100644 --- a/gcc/lto/lto-lang.c +++ b/gcc/lto/lto-lang.c @@ -938,8 +938,10 @@ lto_type_for_mode (enum machine_mode mode, int unsigned_p) return NULL_TREE; } -static int -lto_global_bindings_p (void) +/* Return true if we are in the global binding level. */ + +static bool +lto_global_bindings_p (void) { return cfun == NULL; } diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 6d662377c6d..12ccd803999 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -89,10 +89,10 @@ variable_size (tree size) if (CONTAINS_PLACEHOLDER_P (size)) return self_referential_size (size); - /* If the language-processor is to take responsibility for variable-sized - items (e.g., languages which have elaboration procedures like Ada), - just return SIZE unchanged. */ - if (lang_hooks.decls.global_bindings_p () < 0) + /* If we are in the global binding level, we can't make a SAVE_EXPR + since it may end up being shared across functions, so it is up + to the front-end to deal with this case. */ + if (lang_hooks.decls.global_bindings_p ()) return size; return save_expr (size); |