Fixed bug 3780 - GCC 7 implicit fallthrough warnings
authorSam Lantinga <slouken@libsdl.org>
Wed, 06 Sep 2017 04:32:30 -0700
changeset 11459a09ca9e8938c
parent 11458 ab430a52b113
child 11460 8676072790f0
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
src/video/SDL_blit.h
src/video/SDL_fillrect.c
     1.1 --- a/include/SDL_stdinc.h	Wed Sep 06 10:31:05 2017 -0700
     1.2 +++ b/include/SDL_stdinc.h	Wed Sep 06 04:32:30 2017 -0700
     1.3 @@ -389,10 +389,10 @@
     1.4          return;
     1.5      switch (dwords % 4)
     1.6      {
     1.7 -        case 0: do {    *_p++ = _val;
     1.8 -        case 3:         *_p++ = _val;
     1.9 -        case 2:         *_p++ = _val;
    1.10 -        case 1:         *_p++ = _val;
    1.11 +        case 0: do {    *_p++ = _val;   /* fallthrough */
    1.12 +        case 3:         *_p++ = _val;   /* fallthrough */
    1.13 +        case 2:         *_p++ = _val;   /* fallthrough */
    1.14 +        case 1:         *_p++ = _val;   /* fallthrough */
    1.15          } while ( --_n );
    1.16      }
    1.17  #endif
     2.1 --- a/src/video/SDL_blit.h	Wed Sep 06 10:31:05 2017 -0700
     2.2 +++ b/src/video/SDL_blit.h	Wed Sep 06 04:32:30 2017 -0700
     2.3 @@ -472,14 +472,14 @@
     2.4  #define DUFFS_LOOP8(pixel_copy_increment, width)                        \
     2.5  { int n = (width+7)/8;                                                  \
     2.6      switch (width & 7) {                                                \
     2.7 -    case 0: do {    pixel_copy_increment;                               \
     2.8 -    case 7:     pixel_copy_increment;                                   \
     2.9 -    case 6:     pixel_copy_increment;                                   \
    2.10 -    case 5:     pixel_copy_increment;                                   \
    2.11 -    case 4:     pixel_copy_increment;                                   \
    2.12 -    case 3:     pixel_copy_increment;                                   \
    2.13 -    case 2:     pixel_copy_increment;                                   \
    2.14 -    case 1:     pixel_copy_increment;                                   \
    2.15 +    case 0: do {    pixel_copy_increment; /* fallthrough */             \
    2.16 +    case 7:     pixel_copy_increment;     /* fallthrough */             \
    2.17 +    case 6:     pixel_copy_increment;     /* fallthrough */             \
    2.18 +    case 5:     pixel_copy_increment;     /* fallthrough */             \
    2.19 +    case 4:     pixel_copy_increment;     /* fallthrough */             \
    2.20 +    case 3:     pixel_copy_increment;     /* fallthrough */             \
    2.21 +    case 2:     pixel_copy_increment;     /* fallthrough */             \
    2.22 +    case 1:     pixel_copy_increment;     /* fallthrough */             \
    2.23          } while ( --n > 0 );                                            \
    2.24      }                                                                   \
    2.25  }
     3.1 --- a/src/video/SDL_fillrect.c	Wed Sep 06 10:31:05 2017 -0700
     3.2 +++ b/src/video/SDL_fillrect.c	Wed Sep 06 04:32:30 2017 -0700
     3.3 @@ -144,13 +144,13 @@
     3.4              switch ((uintptr_t) p & 3) {
     3.5              case 1:
     3.6                  *p++ = (Uint8) color;
     3.7 -                --n;
     3.8 +                --n;                    /* fallthrough */
     3.9              case 2:
    3.10                  *p++ = (Uint8) color;
    3.11 -                --n;
    3.12 +                --n;                    /* fallthrough */
    3.13              case 3:
    3.14                  *p++ = (Uint8) color;
    3.15 -                --n;
    3.16 +                --n;                    /* fallthrough */
    3.17              }
    3.18              SDL_memset4(p, color, (n >> 2));
    3.19          }
    3.20 @@ -158,11 +158,11 @@
    3.21              p += (n & ~3);
    3.22              switch (n & 3) {
    3.23              case 3:
    3.24 -                *p++ = (Uint8) color;
    3.25 +                *p++ = (Uint8) color;   /* fallthrough */
    3.26              case 2:
    3.27 -                *p++ = (Uint8) color;
    3.28 +                *p++ = (Uint8) color;   /* fallthrough */
    3.29              case 1:
    3.30 -                *p++ = (Uint8) color;
    3.31 +                *p++ = (Uint8) color;   /* fallthrough */
    3.32              }
    3.33          }
    3.34          pixels += pitch;