From 4ca5d8622a16c8e82153d67e9474614706e39a30 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 6 Sep 2017 04:32:30 -0700 Subject: [PATCH] Fixed bug 3780 - GCC 7 implicit fallthrough warnings Martin Gerhardy 2017-08-28 06:58:01 UTC SDL_blit.h, SDL_fillrect.c and SDL_stdinc.h produces a lot of the (new) gcc-7 implicit fallthrough warnings. --- include/SDL_stdinc.h | 8 ++++---- src/video/SDL_blit.h | 16 ++++++++-------- src/video/SDL_fillrect.c | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/SDL_stdinc.h b/include/SDL_stdinc.h index 38c8876f5..546544f10 100644 --- a/include/SDL_stdinc.h +++ b/include/SDL_stdinc.h @@ -389,10 +389,10 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) return; switch (dwords % 4) { - case 0: do { *_p++ = _val; - case 3: *_p++ = _val; - case 2: *_p++ = _val; - case 1: *_p++ = _val; + case 0: do { *_p++ = _val; /* fallthrough */ + case 3: *_p++ = _val; /* fallthrough */ + case 2: *_p++ = _val; /* fallthrough */ + case 1: *_p++ = _val; /* fallthrough */ } while ( --_n ); } #endif diff --git a/src/video/SDL_blit.h b/src/video/SDL_blit.h index d6b20c32a..6f238abcb 100644 --- a/src/video/SDL_blit.h +++ b/src/video/SDL_blit.h @@ -472,14 +472,14 @@ do { \ #define DUFFS_LOOP8(pixel_copy_increment, width) \ { int n = (width+7)/8; \ switch (width & 7) { \ - case 0: do { pixel_copy_increment; \ - case 7: pixel_copy_increment; \ - case 6: pixel_copy_increment; \ - case 5: pixel_copy_increment; \ - case 4: pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ + case 0: do { pixel_copy_increment; /* fallthrough */ \ + case 7: pixel_copy_increment; /* fallthrough */ \ + case 6: pixel_copy_increment; /* fallthrough */ \ + case 5: pixel_copy_increment; /* fallthrough */ \ + case 4: pixel_copy_increment; /* fallthrough */ \ + case 3: pixel_copy_increment; /* fallthrough */ \ + case 2: pixel_copy_increment; /* fallthrough */ \ + case 1: pixel_copy_increment; /* fallthrough */ \ } while ( --n > 0 ); \ } \ } diff --git a/src/video/SDL_fillrect.c b/src/video/SDL_fillrect.c index 987dcb1d7..463465622 100644 --- a/src/video/SDL_fillrect.c +++ b/src/video/SDL_fillrect.c @@ -144,13 +144,13 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) switch ((uintptr_t) p & 3) { case 1: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 2: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 3: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ } SDL_memset4(p, color, (n >> 2)); } @@ -158,11 +158,11 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) p += (n & ~3); switch (n & 3) { case 3: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 2: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 1: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ } } pixels += pitch;