From 9abe8b744358447b66d579d5592858cfb06c1f75 Mon Sep 17 00:00:00 2001 From: Mikhail Maltsev Date: Thu, 22 Oct 2015 19:21:39 +0000 Subject: [PATCH] [PATCH 3/9] ENABLE_CHECKING refactoring: Java and Ada [PATCH 3/9] ENABLE_CHECKING refactoring: Java and Ada gcc/java/ChangeLog: 2015-10-05 Mikhail Maltsev * decl.c (java_mark_decl_local): Use flag_checking instead of ENABLE_CHECKING. gcc/ada/ChangeLog: 2015-10-05 Mikhail Maltsev * gcc-interface/decl.c (gnat_to_gnu_entity): Use gcc_checking_assert. * gcc-interface/trans.c (assoc_to_constructor): Use flag_checking. * gcc-interface/utils.c (relate_alias_sets): Likewise. * gcc-interface/utils2.c (build_binary_op, build_unary_op): Use gcc_checking_assert From-SVN: r229185 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/gcc-interface/decl.c | 4 +--- gcc/ada/gcc-interface/trans.c | 11 ++++++----- gcc/ada/gcc-interface/utils.c | 4 +--- gcc/ada/gcc-interface/utils2.c | 20 ++++++++------------ gcc/java/ChangeLog | 5 +++++ gcc/java/decl.c | 4 +--- 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3407bd3b4a9..26dee605557 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2015-10-22 Mikhail Maltsev + + * gcc-interface/decl.c (gnat_to_gnu_entity): Use gcc_checking_assert. + * gcc-interface/trans.c (assoc_to_constructor): Use flag_checking. + * gcc-interface/utils.c (relate_alias_sets): Likewise. + * gcc-interface/utils2.c (build_binary_op, build_unary_op): Use + gcc_checking_assert + 2015-10-20 Yannick Moy * fmap.adb, a-cihama.adb, sem_ch5.adb, make.adb, inline.adb, diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index ca36ce5180a..3922bb80cb3 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -2710,10 +2710,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) TYPE_HAS_ACTUAL_BOUNDS_P (gnu_inner) = 1; -#ifdef ENABLE_CHECKING /* Check for other cases of overloading. */ - gcc_assert (!TYPE_ACTUAL_BOUNDS (gnu_inner)); -#endif + gcc_checking_assert (!TYPE_ACTUAL_BOUNDS (gnu_inner)); } for (gnat_index = First_Index (gnat_entity); diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index f1e2dcb41f0..ac190bece98 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -9411,11 +9411,12 @@ assoc_to_constructor (Entity_Id gnat_entity, Node_Id gnat_assoc, tree gnu_type) gnu_result = extract_values (gnu_list, gnu_type); -#ifdef ENABLE_CHECKING - /* Verify that every entry in GNU_LIST was used. */ - for (; gnu_list; gnu_list = TREE_CHAIN (gnu_list)) - gcc_assert (TREE_ADDRESSABLE (gnu_list)); -#endif + if (flag_checking) + { + /* Verify that every entry in GNU_LIST was used. */ + for (; gnu_list; gnu_list = TREE_CHAIN (gnu_list)) + gcc_assert (TREE_ADDRESSABLE (gnu_list)); + } return gnu_result; } diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 917c2803f0d..f270713748f 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -1499,9 +1499,7 @@ relate_alias_sets (tree gnu_new_type, tree gnu_old_type, enum alias_set_op op) /* The alias set shouldn't be copied between array types with different aliasing settings because this can break the aliasing relationship between the array type and its element type. */ -#ifndef ENABLE_CHECKING - if (flag_strict_aliasing) -#endif + if (flag_checking || flag_strict_aliasing) gcc_assert (!(TREE_CODE (gnu_new_type) == ARRAY_TYPE && TREE_CODE (gnu_old_type) == ARRAY_TYPE && TYPE_NONALIASED_COMPONENT (gnu_new_type) diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 70737a9990b..13421b4f051 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -854,9 +854,8 @@ build_binary_op (enum tree_code op_code, tree result_type, { case INIT_EXPR: case MODIFY_EXPR: -#ifdef ENABLE_CHECKING - gcc_assert (result_type == NULL_TREE); -#endif + gcc_checking_assert (result_type == NULL_TREE); + /* If there were integral or pointer conversions on the LHS, remove them; we'll be putting them back below if needed. Likewise for conversions between array and record types, except for justified @@ -1039,9 +1038,8 @@ build_binary_op (enum tree_code op_code, tree result_type, case TRUTH_AND_EXPR: case TRUTH_OR_EXPR: case TRUTH_XOR_EXPR: -#ifdef ENABLE_CHECKING - gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE); -#endif + gcc_checking_assert (TREE_CODE ( + get_base_type (result_type)) == BOOLEAN_TYPE); operation_type = left_base_type; left_operand = convert (operation_type, left_operand); right_operand = convert (operation_type, right_operand); @@ -1053,9 +1051,8 @@ build_binary_op (enum tree_code op_code, tree result_type, case LT_EXPR: case EQ_EXPR: case NE_EXPR: -#ifdef ENABLE_CHECKING - gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE); -#endif + gcc_checking_assert (TREE_CODE ( + get_base_type (result_type)) == BOOLEAN_TYPE); /* If either operand is a NULL_EXPR, just return a new one. */ if (TREE_CODE (left_operand) == NULL_EXPR) return build2 (op_code, result_type, @@ -1335,9 +1332,8 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) break; case TRUTH_NOT_EXPR: -#ifdef ENABLE_CHECKING - gcc_assert (TREE_CODE (get_base_type (result_type)) == BOOLEAN_TYPE); -#endif + gcc_checking_assert (TREE_CODE ( + get_base_type (result_type)) == BOOLEAN_TYPE); result = invert_truthvalue_loc (EXPR_LOCATION (operand), operand); /* When not optimizing, fold the result as invert_truthvalue_loc doesn't fold the result of comparisons. This is intended to undo diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 1414c479359..3d1ad640ca4 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2015-10-22 Mikhail Maltsev + + * decl.c (java_mark_decl_local): Use flag_checking instead of + ENABLE_CHECKING. + 2015-07-15 Andrew MacLeod * expr.c: Remove multiline #include comment. diff --git a/gcc/java/decl.c b/gcc/java/decl.c index c035fe05896..2b33621d15e 100644 --- a/gcc/java/decl.c +++ b/gcc/java/decl.c @@ -1905,14 +1905,12 @@ java_mark_decl_local (tree decl) { DECL_EXTERNAL (decl) = 0; -#ifdef ENABLE_CHECKING /* Double check that we didn't pass the function to the callgraph early. */ - if (TREE_CODE (decl) == FUNCTION_DECL) + if (flag_checking && TREE_CODE (decl) == FUNCTION_DECL) { struct cgraph_node *node = cgraph_node::get (decl); gcc_assert (!node || !node->definition); } -#endif gcc_assert (!DECL_RTL_SET_P (decl)); } -- 2.30.2