aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-08 16:25:31 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-08 16:25:31 -0400
commitd0cf395a999499cfdc785cdb920bfdf401a628aa (patch)
treef26032d4656084707e134821ce7a0fc9c5c21ae5 /gcc/cp
parent8a1b7b7fd75a38474a335a98ac97d674b4c38b20 (diff)
downloadgcc-d0cf395a999499cfdc785cdb920bfdf401a628aa.zip
gcc-d0cf395a999499cfdc785cdb920bfdf401a628aa.tar.gz
gcc-d0cf395a999499cfdc785cdb920bfdf401a628aa.tar.bz2
P0145: Refining Expression Order for C++ (-fstrong-eval-order).
gcc/c-family/ * c.opts (-fargs-in-order): Rename to -fstrong-eval-order. * c-opts.c: Adjust. gcc/cp/ * call.c (op_is_ordered, build_over_call): Adjust for -fargs-in-order renaming to -fstrong-eval-order. * cp-gimplify.c (cp_gimplify_expr): Likewise. From-SVN: r238176
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/call.c17
-rw-r--r--gcc/cp/cp-gimplify.c5
3 files changed, 16 insertions, 13 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 12f15db..13f80f9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2016-07-08 Jason Merrill <jason@redhat.com>
+
+ P0145R2: Refining Expression Order for C++.
+ * call.c (op_is_ordered, build_over_call): Adjust for
+ -fargs-in-order renaming to -fstrong-eval-order.
+ * cp-gimplify.c (cp_gimplify_expr): Likewise.
+
2016-07-07 Jakub Jelinek <jakub@redhat.com>
Kai Tietz <ktietz70@googlemail.com>
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index d77092b..8b93c61 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -5378,14 +5378,15 @@ add_candidates (tree fns, tree first_arg, const vec<tree, va_gc> *args,
static int
op_is_ordered (tree_code code)
{
- if (!flag_args_in_order)
- return 0;
-
switch (code)
{
// 5. b @= a
case MODIFY_EXPR:
- return -1;
+ return (flag_strong_eval_order > 1 ? -1 : 0);
+
+ // 6. a[b]
+ case ARRAY_REF:
+ return (flag_strong_eval_order > 1 ? 1 : 0);
// 1. a.b
// Not overloadable (yet).
@@ -5393,13 +5394,11 @@ op_is_ordered (tree_code code)
// Only one argument.
// 3. a->*b
case MEMBER_REF:
- // 6. a[b]
- case ARRAY_REF:
// 7. a << b
case LSHIFT_EXPR:
// 8. a >> b
case RSHIFT_EXPR:
- return 1;
+ return (flag_strong_eval_order ? 1 : 0);
default:
return 0;
@@ -7830,9 +7829,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
tree call = build_cxx_call (fn, nargs, argarray, complain|decltype_flag);
if (call != error_mark_node
- && !magic
- && (flag_args_in_order > 1
- || (cand->flags & LOOKUP_LIST_INIT_CTOR)))
+ && cand->flags & LOOKUP_LIST_INIT_CTOR)
{
tree c = extract_call_expr (call);
/* build_new_op_1 will clear this when appropriate. */
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index 1d81fb1..c04368f 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -780,11 +780,10 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
ret = GS_ERROR;
}
}
- else if (flag_args_in_order == 1
+ else if (flag_strong_eval_order
&& !CALL_EXPR_OPERATOR_SYNTAX (*expr_p))
{
- /* If flag_args_in_order == 1, we don't force an order on all
- function arguments, but do evaluate the object argument first. */
+ /* If flag_strong_eval_order, evaluate the object argument first. */
tree fntype = TREE_TYPE (CALL_EXPR_FN (*expr_p));
if (POINTER_TYPE_P (fntype))
fntype = TREE_TYPE (fntype);