From: Eric Botcazou Date: Wed, 20 Dec 2017 09:38:47 +0000 (+0000) Subject: trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=278f422cdf76cdf918e76e3c002b2d67fe2be07c;p=gcc.git trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro. * gcc-interface/trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro. * gcc-interface/misc.c (gnat_get_array_descr_info): Likewise. (default_pass_by_ref): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise. From-SVN: r255854 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e9f217346ad..d06ddffa0c9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,9 +1,16 @@ +2017-12-20 Eric Botcazou + + * gcc-interface/trans.c (Loop_Statement_to_gnu): Use IN_RANGE macro. + * gcc-interface/misc.c (gnat_get_array_descr_info): Likewise. + (default_pass_by_ref): Likewise. + * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise. + 2017-12-19 Jakub Jelinek * gcc-interface/trans.c (Loop_Statement_to_gnu): Replace Yoda conditions with typical order conditions. - * gcc-interface/misc.c (gnat_get_array_descr_info, - default_pass_by_ref): Likewise. + * gcc-interface/misc.c (gnat_get_array_descr_info): Likewise. + (default_pass_by_ref): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity): Likewise. * adaint.c (__gnat_tmp_name): Likewise. diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 84fd588d238..20d35f3a5dc 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -2111,7 +2111,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) index to the template. */ for (index = (convention_fortran_p ? ndim - 1 : 0), gnat_index = First_Index (gnat_entity); - index >= 0 && index < ndim; + IN_RANGE (index, 0, ndim - 1); index += (convention_fortran_p ? - 1 : 1), gnat_index = Next_Index (gnat_index)) { @@ -2362,7 +2362,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) gnat_index = First_Index (gnat_entity), gnat_base_index = First_Index (Implementation_Base_Type (gnat_entity)); - index >= 0 && index < ndim; + IN_RANGE (index, 0, ndim - 1); index += (convention_fortran_p ? - 1 : 1), gnat_index = Next_Index (gnat_index), gnat_base_index = Next_Index (gnat_base_index)) diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index 3eda489a36d..7401d2df27f 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -953,7 +953,7 @@ gnat_get_array_descr_info (const_tree const_type, structure. */ for (i = (convention_fortran_p ? info->ndimensions - 1 : 0), dimen = first_dimen; - i >= 0 && i < info->ndimensions; + IN_RANGE (i, 0, info->ndimensions - 1); i += (convention_fortran_p ? -1 : 1), dimen = TREE_TYPE (dimen)) { diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 7e7bac9aa4a..9f34718f16d 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -3190,8 +3190,9 @@ Loop_Statement_to_gnu (Node_Id gnat_node) /* Note that loop unswitching can only be applied a small number of times to a given loop (PARAM_MAX_UNSWITCH_LEVEL default to 3). */ - if (n_remaining_checks > 0 && n_remaining_checks <= 3 - && optimize > 1 && !optimize_size) + if (IN_RANGE (n_remaining_checks, 1, 3) + && optimize > 1 + && !optimize_size) FOR_EACH_VEC_ELT (*gnu_loop_info->checks, i, rci) if (rci->invariant_cond != boolean_false_node) {