[PATCH 3/9] ENABLE_CHECKING refactoring: Java and Ada
authorMikhail Maltsev <maltsevm@gmail.com>
Thu, 22 Oct 2015 19:21:39 +0000 (19:21 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 22 Oct 2015 19:21:39 +0000 (13:21 -0600)
[PATCH 3/9] ENABLE_CHECKING refactoring: Java and Ada
gcc/java/ChangeLog:

2015-10-05  Mikhail Maltsev  <maltsevm@gmail.com>

* decl.c (java_mark_decl_local): Use flag_checking instead of
ENABLE_CHECKING.

gcc/ada/ChangeLog:

2015-10-05  Mikhail Maltsev  <maltsevm@gmail.com>

* 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
gcc/ada/gcc-interface/decl.c
gcc/ada/gcc-interface/trans.c
gcc/ada/gcc-interface/utils.c
gcc/ada/gcc-interface/utils2.c
gcc/java/ChangeLog
gcc/java/decl.c

index 3407bd3..26dee60 100644 (file)
@@ -1,3 +1,11 @@
+2015-10-22  Mikhail Maltsev  <maltsevm@gmail.com>
+
+       * 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  <moy@adacore.com>
 
        * fmap.adb, a-cihama.adb, sem_ch5.adb, make.adb, inline.adb,
index ca36ce5..3922bb8 100644 (file)
@@ -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);
index f1e2dcb..ac190be 100644 (file)
@@ -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;
 }
index 917c280..f270713 100644 (file)
@@ -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)
index 70737a9..13421b4 100644 (file)
@@ -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
index 1414c47..3d1ad64 100644 (file)
@@ -1,3 +1,8 @@
+2015-10-22  Mikhail Maltsev  <maltsevm@gmail.com>
+
+       * decl.c (java_mark_decl_local): Use flag_checking instead of
+       ENABLE_CHECKING.
+
 2015-07-15  Andrew MacLeod  <amacleod@redhat.com>
 
        * expr.c: Remove multiline #include comment.
index c035fe0..2b33621 100644 (file)
@@ -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));
 }