aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorPierre-Marie de Rodat <derodat@adacore.com>2016-10-11 10:19:39 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-10-11 10:19:39 +0000
commit08ef2c16779f0f1814cc1f49bf53e7504942f079 (patch)
tree17830370fb0bc223697052c20038f600115efa0e /gcc/ada/gcc-interface/decl.c
parentabb3ea16fa70565acae570e7410eb6702cf631ed (diff)
downloadgcc-08ef2c16779f0f1814cc1f49bf53e7504942f079.zip
gcc-08ef2c16779f0f1814cc1f49bf53e7504942f079.tar.gz
gcc-08ef2c16779f0f1814cc1f49bf53e7504942f079.tar.bz2
utils2.c (build_binary_op): Add a NO_FOLD argument.
* gcc-interface/utils2.c (build_binary_op): Add a NO_FOLD argument. Disable folding when true. * gcc-interface/gigi.h (choices_to_gnu): Remove declaration. (build_binary_op): Update signature and comment. * gcc-interface/decl.c (choices_to_gnu): Make static. Disable folding for all calls to build_binary_op. From-SVN: r240978
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 58d6625..3aaaaca 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -6832,7 +6832,7 @@ elaborate_reference (tree ref, Entity_Id gnat_entity, bool definition,
/* Given a GNU tree and a GNAT list of choices, generate an expression to test
the value passed against the list of choices. */
-tree
+static tree
choices_to_gnu (tree operand, Node_Id choices)
{
Node_Id choice;
@@ -6851,9 +6851,10 @@ choices_to_gnu (tree operand, Node_Id choices)
this_test
= build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node,
build_binary_op (GE_EXPR, boolean_type_node,
- operand, low),
+ operand, low, true),
build_binary_op (LE_EXPR, boolean_type_node,
- operand, high));
+ operand, high, true),
+ true);
break;
@@ -6865,9 +6866,10 @@ choices_to_gnu (tree operand, Node_Id choices)
this_test
= build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node,
build_binary_op (GE_EXPR, boolean_type_node,
- operand, low),
+ operand, low, true),
build_binary_op (LE_EXPR, boolean_type_node,
- operand, high));
+ operand, high, true),
+ true);
break;
case N_Identifier:
@@ -6886,9 +6888,10 @@ choices_to_gnu (tree operand, Node_Id choices)
this_test
= build_binary_op (TRUTH_ANDIF_EXPR, boolean_type_node,
build_binary_op (GE_EXPR, boolean_type_node,
- operand, low),
+ operand, low, true),
build_binary_op (LE_EXPR, boolean_type_node,
- operand, high));
+ operand, high, true),
+ true);
break;
}
@@ -6898,7 +6901,7 @@ choices_to_gnu (tree operand, Node_Id choices)
case N_Integer_Literal:
single = gnat_to_gnu (choice);
this_test = build_binary_op (EQ_EXPR, boolean_type_node, operand,
- single);
+ single, true);
break;
case N_Others_Choice:
@@ -6909,8 +6912,11 @@ choices_to_gnu (tree operand, Node_Id choices)
gcc_unreachable ();
}
- result = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, result,
- this_test);
+ if (result == boolean_false_node)
+ result = this_test;
+ else
+ result = build_binary_op (TRUTH_ORIF_EXPR, boolean_type_node, result,
+ this_test, true);
}
return result;