public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] sim: common: fix -Wimplicit-fallthrough warnings
@ 2023-12-21  7:01 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2023-12-21  7:01 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9362022e951aa23728aee3e5e9e6db453a3259c2

commit 9362022e951aa23728aee3e5e9e6db453a3259c2
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Thu Dec 21 01:29:53 2023 -0500

    sim: common: fix -Wimplicit-fallthrough warnings
    
    Replace some fall through comments with the attribute.

Diff:
---
 sim/common/dv-cfi.c        | 6 ++++--
 sim/common/hw-properties.c | 2 +-
 sim/common/sim-memopt.c    | 4 ++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sim/common/dv-cfi.c b/sim/common/dv-cfi.c
index 95498d7a2f4..b9c9acdb682 100644
--- a/sim/common/dv-cfi.c
+++ b/sim/common/dv-cfi.c
@@ -210,7 +210,7 @@ cfi_unshift_addr (struct cfi *cfi, unsigned addr)
 {
   switch (cfi->width)
     {
-    case 4: addr >>= 1; /* fallthrough.  */
+    case 4: addr >>= 1; ATTRIBUTE_FALLTHROUGH;
     case 2: addr >>= 1;
     }
   return addr;
@@ -414,7 +414,7 @@ cfi_io_write_buffer (struct hw *me, const void *source, int space,
 	  goto done;
 	}
 
-      /* Fall through.  */
+      ATTRIBUTE_FALLTHROUGH;
 
     default:
       if (!cfi->cmdset->write (me, cfi, source, offset, value, nr_bytes))
@@ -490,6 +490,8 @@ cfi_io_read_buffer (struct hw *me, void *dest, int space,
 	  break;
 	}
 
+      ATTRIBUTE_FALLTHROUGH;
+
     default:
       if (!cfi->cmdset->read (me, cfi, dest, offset, shifted_offset, nr_bytes))
 	HW_TRACE ((me, "unhandled state %s", state_names[cfi->state]));
diff --git a/sim/common/hw-properties.c b/sim/common/hw-properties.c
index f1d7a77ec50..42b4d3a7426 100644
--- a/sim/common/hw-properties.c
+++ b/sim/common/hw-properties.c
@@ -829,7 +829,7 @@ hw_find_string_array_property (struct hw *me,
       if (node->sizeof_array == 0
 	  || ((char*)node->array)[node->sizeof_array - 1] != '\0')
 	hw_abort (me, "property \"%s\" invalid for string array", property);
-      /* FALL THROUGH */
+      ATTRIBUTE_FALLTHROUGH;
     case string_array_property:
       ASSERT (node->sizeof_array > 0);
       ASSERT (((char*)node->array)[node->sizeof_array - 1] == '\0');
diff --git a/sim/common/sim-memopt.c b/sim/common/sim-memopt.c
index 7d46a864afc..c179d6ab810 100644
--- a/sim/common/sim-memopt.c
+++ b/sim/common/sim-memopt.c
@@ -300,10 +300,10 @@ parse_size (char *chp,
       break;
     case 'g': case 'G': /* Gigabyte suffix.  */
       *nr_bytes <<= 10;
-      /* Fall through.  */
+      ATTRIBUTE_FALLTHROUGH;
     case 'm': case 'M': /* Megabyte suffix.  */
       *nr_bytes <<= 10;
-      /* Fall through.  */
+      ATTRIBUTE_FALLTHROUGH;
     case 'k': case 'K': /* Kilobyte suffix.  */
       *nr_bytes <<= 10;
       /* Check for a modulo specifier after the suffix.  */

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

only message in thread, other threads:[~2023-12-21  7:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21  7:01 [binutils-gdb] sim: common: fix -Wimplicit-fallthrough warnings Michael Frysinger

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).