Hi all!
This patch was intended to be the last one in this series (but I'll send one
more cleanup patch today). It removes ENABLE_CHECKING macros in the C++ front
end (and also touches a small piece of common C family code in OpenMP).
I could convert most of "#ifdef ENABLE_CHECKING" conditions into checks
performed at run time (i.e. flag_checking), except for
GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT logic. The definition of this macro depends
on ENABLE_CHECKING (now CHECKING_P) and frankly speaking I don't know how these
checks should work (though I did not try hard to understand the details, I hope
Jason will give some comments), so I left them as-is, just got rid of
conditional compilation (i.e., used CHECKING_P).
Also, the patch renames 'check_unstripped_args' into 'verify_unstripped_args'
because I think it's more consistent with names of other internal state checking
functions.
Bootstrapped and regtested on x86_64-pc-linux-gnu with --enable-checking=yes and
--enable-checking=release. (there were some problems with languages other than C
and C++, not related to the patch, but ISTM they were fixed, so I'm currently
running a second check after rebasing).
OK for trunk?
--
Regards,
Mikhail Maltsev
gcc/c-family/ChangeLog:
2015-10-31 Mikhail Maltsev
* c-omp.c (c_omp_split_clauses): Remove conditional compilation. Use
flag_checking.
gcc/cp/ChangeLog:
2015-10-31 Mikhail Maltsev
* call.c (validate_conversion_obstack): Define unconditionally.
* constexpr.c (maybe_constant_value, fold_non_dependent_expr): Use
gcc_checking_assert.
* cp-tree.h: Use CHECKING_P instead of ENABLE_CHECKING.
* decl2.c (cxx_post_compilation_parsing_cleanups): Use flag_checking.
* mangle.c (add_substitution): Likewise.
* method.c (maybe_explain_implicit_delete): Likewise.
* parser.c (cp_parser_template_argument_list): Remove conditional
compilation.
* pt.c (check_unstripped_args): Rename to...
(verify_unstripped_args): ...this and remove conditional compilation.
(retrieve_specialization): Guard call of verify_unstripped_args with
flag_checking.
(template_parm_to_arg): Remove conditional compilation.
(template_parms_to_args, coerce_template_parameter_pack,
coerce_template_parms): Likewise.
(tsubst_copy): Use flag_checking.
(type_unification_real): Remove conditional compilation.
(build_non_dependent_expr): Use flag_checking.
* tree.c (build_target_expr): Remove conditional compilation, use
gcc_checking_assert.
* typeck.c (comptypes): Likewise.
* typeck2.c (digest_init_r): Likewise.
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index 133d079..ca64eda 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -1135,7 +1135,10 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
OMP_CLAUSE_CHAIN (clauses) = cclauses[s];
cclauses[s] = clauses;
}
-#ifdef ENABLE_CHECKING
+
+ if (!flag_checking)
+return;
+
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_MAP)) == 0)
gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_TARGET] == NULL_TREE);
if ((mask & (OMP_CLAUSE_MASK_1 << PRAGMA_OMP_CLAUSE_NUM_TEAMS)) == 0)
@@ -1150,7 +1153,6 @@ c_omp_split_clauses (location_t loc, enum tree_code code,
gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_FOR] == NULL_TREE);
if (code != OMP_SIMD)
gcc_assert (cclauses[C_OMP_CLAUSE_SPLIT_SIMD] == NULL_TREE);
-#endif
}
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 9178188..0b7d143 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -724,8 +724,6 @@ alloc_conversion (conversion_kind kind)
return c;
}
-#ifdef ENABLE_CHECKING
-
/* Make sure that all memory on the conversion obstack has been
freed. */
@@ -737,8 +735,6 @@ validate_conversion_obstack (void)
== obstack_base (_obstack)));
}
-#endif /* ENABLE_CHECKING */
-
/* Dynamically allocate an array of N conversions. */
static conversion **
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 038c6f5..51fae5a 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -3856,13 +3856,11 @@ maybe_constant_value (tree t, tree decl)
}
r = cxx_eval_outermost_constant_expr (t, true, true, decl);
-#ifdef ENABLE_CHECKING
- gcc_assert (r == t
- || CONVERT_EXPR_P (t)
- || TREE_CODE (t) == VIEW_CONVERT_EXPR
- || (TREE_CONSTANT (t) && !TREE_CONSTANT (r))
- || !cp_tree_equal (r, t));
-#endif
+ gcc_checking_assert (r == t
+ || CONVERT_EXPR_P (t)
+ || TREE_CODE (t) == VIEW_CONVERT_EXPR
+ || (TREE_CONSTANT (t) && !TREE_CONSTANT (r))
+ || !cp_tree_equal (r, t));
return r;
}
@@ -3906,14 +3904,12 @@ fold_non_dependent_expr (tree t)
}
tree r = cxx_eval_outermost_constant_expr (t, true, true, NULL_TREE);
-#ifdef ENABLE_CHECKING
/* cp_tree_equal looks through