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.
This commit is contained in:
Sam Lantinga 2017-09-06 04:32:30 -07:00
parent 28bf56c12c
commit 4ca5d8622a
3 changed files with 18 additions and 18 deletions

View file

@ -389,10 +389,10 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords)
return; return;
switch (dwords % 4) switch (dwords % 4)
{ {
case 0: do { *_p++ = _val; case 0: do { *_p++ = _val; /* fallthrough */
case 3: *_p++ = _val; case 3: *_p++ = _val; /* fallthrough */
case 2: *_p++ = _val; case 2: *_p++ = _val; /* fallthrough */
case 1: *_p++ = _val; case 1: *_p++ = _val; /* fallthrough */
} while ( --_n ); } while ( --_n );
} }
#endif #endif

View file

@ -472,14 +472,14 @@ do { \
#define DUFFS_LOOP8(pixel_copy_increment, width) \ #define DUFFS_LOOP8(pixel_copy_increment, width) \
{ int n = (width+7)/8; \ { int n = (width+7)/8; \
switch (width & 7) { \ switch (width & 7) { \
case 0: do { pixel_copy_increment; \ case 0: do { pixel_copy_increment; /* fallthrough */ \
case 7: pixel_copy_increment; \ case 7: pixel_copy_increment; /* fallthrough */ \
case 6: pixel_copy_increment; \ case 6: pixel_copy_increment; /* fallthrough */ \
case 5: pixel_copy_increment; \ case 5: pixel_copy_increment; /* fallthrough */ \
case 4: pixel_copy_increment; \ case 4: pixel_copy_increment; /* fallthrough */ \
case 3: pixel_copy_increment; \ case 3: pixel_copy_increment; /* fallthrough */ \
case 2: pixel_copy_increment; \ case 2: pixel_copy_increment; /* fallthrough */ \
case 1: pixel_copy_increment; \ case 1: pixel_copy_increment; /* fallthrough */ \
} while ( --n > 0 ); \ } while ( --n > 0 ); \
} \ } \
} }

View file

@ -144,13 +144,13 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h)
switch ((uintptr_t) p & 3) { switch ((uintptr_t) p & 3) {
case 1: case 1:
*p++ = (Uint8) color; *p++ = (Uint8) color;
--n; --n; /* fallthrough */
case 2: case 2:
*p++ = (Uint8) color; *p++ = (Uint8) color;
--n; --n; /* fallthrough */
case 3: case 3:
*p++ = (Uint8) color; *p++ = (Uint8) color;
--n; --n; /* fallthrough */
} }
SDL_memset4(p, color, (n >> 2)); 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); p += (n & ~3);
switch (n & 3) { switch (n & 3) {
case 3: case 3:
*p++ = (Uint8) color; *p++ = (Uint8) color; /* fallthrough */
case 2: case 2:
*p++ = (Uint8) color; *p++ = (Uint8) color; /* fallthrough */
case 1: case 1:
*p++ = (Uint8) color; *p++ = (Uint8) color; /* fallthrough */
} }
} }
pixels += pitch; pixels += pitch;