Skip to content

Commit

Permalink
Fixed bug 3780 - GCC 7 implicit fallthrough warnings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
slouken committed Sep 6, 2017
1 parent 28bf56c commit 4ca5d86
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions include/SDL_stdinc.h
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/video/SDL_blit.h
Expand Up @@ -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 ); \
} \
}
Expand Down
12 changes: 6 additions & 6 deletions src/video/SDL_fillrect.c
Expand Up @@ -144,25 +144,25 @@ 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));
}
if (n & 3) {
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;
Expand Down

0 comments on commit 4ca5d86

Please sign in to comment.