Browse Source

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.
Sam Lantinga 7 years ago
parent
commit
4ca5d8622a
3 changed files with 18 additions and 18 deletions
  1. 4 4
      include/SDL_stdinc.h
  2. 8 8
      src/video/SDL_blit.h
  3. 6 6
      src/video/SDL_fillrect.c

+ 4 - 4
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

+ 8 - 8
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 );                                            \
     }                                                                   \
 }

+ 6 - 6
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;