diff options
author | Nathan Sidwell <nathan@acm.org> | 2018-05-07 23:04:22 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2018-05-07 23:04:22 +0000 |
commit | ee336e846de46aa5523a96f712d247c31a07c6e1 (patch) | |
tree | 8c66e81acd1034522f08d278a608f49f42e64ee3 /gcc/cp/semantics.c | |
parent | 1d473b8b9dd499a5e34d6a05d9ef2f4b521d1056 (diff) | |
download | gcc-ee336e846de46aa5523a96f712d247c31a07c6e1.zip gcc-ee336e846de46aa5523a96f712d247c31a07c6e1.tar.gz gcc-ee336e846de46aa5523a96f712d247c31a07c6e1.tar.bz2 |
[C++ PATCH] Kill -fno-for-scope
https://gcc.gnu.org/ml/gcc-patches/2018-05/msg00299.html
gcc/cp/
Remove fno-for-scope
* cp-tree.h (DECL_ERROR_REPORTED, DECL_DEAD_FOR_LOCAL)
(DECL_HAS_SHADOWED_FOR_VAR_P, DECL_SHADOWED_FOR_VAR)
(SET_DECL_SHADOWED_FOR_VAR): Delete.
(decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
(check_for_out_of_scope_variable, init_shadowed_var_for_decl):
Don't declare.
* name-lookup.h (struct cp_binding_level): Remove
dead_vars_from_for field.
* cp-lang.c (cp_init_ts): Delete.
(LANG_HOOKS_INIT_TS): Override to cp_common_init_ts.
* cp-objcp-common.c (shadowed_var_for_decl): Delete.
(decl_shadowed_for_var_lookup, decl_shadowed_for_var_insert)
(init_shadowed_var_for_decl): Delete.
* decl.c (poplevel): Remove shadowed for var handling.
(cxx_init_decl_processing): Remove -ffor-scope deprecation.
* name-lookup.c (find_local_binding): Remove shadowed for var
handling.
(check_local_shadow): Likewise.
(check_for_out_of_scope_variable): Delete.
* parser.c (cp_parser_primary_expression): Remove shadowed for var
handling.
* pt.c (tsubst_decl): Remove DECL_DEAD_FOR_LOCAL setting.
* semantics.c (begin_for_scope): Always have a scope.
(begin_for_stmt, finish_for_stmt): Remove ARM-for scope handling.
(begin_range_for_stmt, finish_id_expression): Likewise.
gcc/
* doc/invoke.texi (C++ Dialect Options): Remove -ffor-scope.
* doc/extend.texi (Deprecated Features): Remove -fno-for-scope
(Backwards Compatibility): Likewise.
c-family/
* c.opt (ffor-scope): Remove functionality, issue warning.
gcc/objcp/
* objcp-lang.c (objcxx_init_ts): Don't call init_shadowed_var_for_decl.
gcc/testsuite/
* g++.dg/cpp0x/range-for10.C: Delete.
* g++.dg/ext/forscope1.C: Delete.
* g++.dg/ext/forscope2.C: Delete.
* g++.dg/template/for1.C: Delete.
From-SVN: r260015
Diffstat (limited to 'gcc/cp/semantics.c')
-rw-r--r-- | gcc/cp/semantics.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 4568bb9..2b2b51b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -934,9 +934,7 @@ finish_return_stmt (tree expr) tree begin_for_scope (tree *init) { - tree scope = NULL_TREE; - if (flag_new_for_scope) - scope = do_pushlevel (sk_for); + tree scope = do_pushlevel (sk_for); if (processing_template_decl) *init = push_stmt_list (); @@ -960,10 +958,10 @@ begin_for_stmt (tree scope, tree init) if (scope == NULL_TREE) { - gcc_assert (!init || !flag_new_for_scope); - if (!init) - scope = begin_for_scope (&init); + gcc_assert (!init); + scope = begin_for_scope (&init); } + FOR_INIT_STMT (r) = init; FOR_SCOPE (r) = scope; @@ -1057,16 +1055,12 @@ finish_for_stmt (tree for_stmt) FOR_BODY (for_stmt) = do_poplevel (FOR_BODY (for_stmt)); /* Pop the scope for the body of the loop. */ - if (flag_new_for_scope) - { - tree scope; - tree *scope_ptr = (TREE_CODE (for_stmt) == RANGE_FOR_STMT - ? &RANGE_FOR_SCOPE (for_stmt) - : &FOR_SCOPE (for_stmt)); - scope = *scope_ptr; - *scope_ptr = NULL; - add_stmt (do_poplevel (scope)); - } + tree *scope_ptr = (TREE_CODE (for_stmt) == RANGE_FOR_STMT + ? &RANGE_FOR_SCOPE (for_stmt) + : &FOR_SCOPE (for_stmt)); + tree scope = *scope_ptr; + *scope_ptr = NULL; + add_stmt (do_poplevel (scope)); } /* Begin a range-for-statement. Returns a new RANGE_FOR_STMT. @@ -1077,18 +1071,15 @@ finish_for_stmt (tree for_stmt) tree begin_range_for_stmt (tree scope, tree init) { - tree r; - begin_maybe_infinite_loop (boolean_false_node); - r = build_stmt (input_location, RANGE_FOR_STMT, - NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE); + tree r = build_stmt (input_location, RANGE_FOR_STMT, + NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE, NULL_TREE); if (scope == NULL_TREE) { - gcc_assert (!init || !flag_new_for_scope); - if (!init) - scope = begin_for_scope (&init); + gcc_assert (!init); + scope = begin_for_scope (&init); } /* RANGE_FOR_STMTs do not use nor save the init tree, so we @@ -3560,11 +3551,6 @@ finish_id_expression (tree id_expression, else decl = id_expression; } - /* If DECL is a variable that would be out of scope under - ANSI/ISO rules, but in scope in the ARM, name lookup - will succeed. Issue a diagnostic here. */ - else - decl = check_for_out_of_scope_variable (decl); /* Remember that the name was used in the definition of the current class so that we can check later to see if |