public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3208] d: Convert convert_for_rvalue switch statement into if condition
@ 2021-08-29 16:31 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2021-08-29 16:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ce15a3e757c3a0adc611d907a3d4ba00c243a8f0

commit r12-3208-gce15a3e757c3a0adc611d907a3d4ba00c243a8f0
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Aug 28 20:21:21 2021 +0200

    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:
---
 gcc/d/d-convert.cc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gcc/d/d-convert.cc b/gcc/d/d-convert.cc
index d43485dca77..3b4790298a5 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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-29 16:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-29 16:31 [gcc r12-3208] d: Convert convert_for_rvalue switch statement into if condition Iain Buclaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).