# SDL: stdinc: Silence clang warning for -Wimplicit-fallthrough.

**URL:** <https://discourse.libsdl.org/t/sdl-stdinc-silence-clang-warning-for-wimplicit-fallthrough/31799>\
**Category:** SDL Commits\
**Created:** [June 10, 2021, 6:00pm UTC](https://discourse.libsdl.org/t/sdl-stdinc-silence-clang-warning-for-wimplicit-fallthrough/31799 "2021-06-10T18:00:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [June 10, 2021, 6:00pm UTC](https://discourse.libsdl.org/t/sdl-stdinc-silence-clang-warning-for-wimplicit-fallthrough/31799/1 "2021-06-10T18:00:02Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/25fc40b0bd44c484051064bc6b945ea9943f88dd>
>
> In a more ideal world, we'd use the appropriate \`\_\_attribute\_\_\` here, but
> it's …one thing in a public header that probably shouldn't be there at all, so
> this is good enough for now.
> 
> Fixes #4307.

```diff
From 25fc40b0bd44c484051064bc6b945ea9943f88dd Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Thu, 10 Jun 2021 13:56:22 -0400
Subject: [PATCH] stdinc: Silence clang warning for -Wimplicit-fallthrough.

In a more ideal world, we'd use the appropriate ` __attribute__ ` here, but
it's one thing in a public header that probably shouldn't be there at all, so
this is good enough for now.

Fixes #4307.
---
 include/SDL_stdinc.h | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h
index d286e68a9..0cbbb436b 100644
--- a/include/SDL_stdinc.h
+++ b/include/SDL_stdinc.h
@@ -481,16 +481,28 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
     size_t _n = (dwords + 3) / 4;
     Uint32 *_p = SDL_static_cast(Uint32 *, dst);
     Uint32 _val = (val);
- if (dwords == 0)
+ if (dwords == 0) {
         return;
- switch (dwords % 4)
- {
+ }
+
+ /* !!! FIXME: there are better ways to do this, but this is just to clean this up for now. */
+ #ifdef __clang__
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wimplicit-fallthrough"
+ #endif
+
+ switch (dwords % 4) {
         case 0: do { *_p++ = _val; /* fallthrough */
         case 3: *_p++ = _val; /* fallthrough */
         case 2: *_p++ = _val; /* fallthrough */
         case 1: *_p++ = _val; /* fallthrough */
         } while ( --_n );
     }
+
+ #ifdef __clang__
+ #pragma clang diagnostic pop
+ #endif
+
 #endif
 }
 

```
