From: Iain Buclaw Date: Sat, 28 Aug 2021 18:21:21 +0000 (+0200) Subject: d: Convert convert_for_rvalue switch statement into if condition X-Git-Tag: upstream/12.2.0~5489 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce15a3e757c3a0adc611d907a3d4ba00c243a8f0;p=platform%2Fupstream%2Fgcc.git d: Convert convert_for_rvalue switch statement into if condition gcc/d/ChangeLog: * d-convert.cc (convert_for_rvalue): Convert switch statement into if condition. --- diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc index d43485d..3b47902 100644 --- a/gcc/d/d-convert.cc +++ b/gcc/d/d-convert.cc @@ -613,9 +613,8 @@ convert_for_rvalue (tree expr, Type *etype, Type *totype) Type *ebtype = etype->toBasetype (); Type *tbtype = totype->toBasetype (); - switch (ebtype->ty) + if (ebtype->ty == Tbool) { - case Tbool: /* If casting from bool, the result is either 0 or 1, any other value violates @safe code, so enforce that it is never invalid. */ if (CONSTANT_CLASS_P (expr)) @@ -633,7 +632,6 @@ convert_for_rvalue (tree expr, Type *etype, Type *totype) } result = convert (build_ctype (tbtype), result); - break; } return result ? result : convert_expr (expr, etype, totype);