Browse Source

Fix warnings when building with -DSDL_LIBC=OFF on Linux

Anonymous Maarten 1 year ago
parent
commit
009318c5a9
3 changed files with 10 additions and 6 deletions
  1. 4 2
      src/stdlib/SDL_memcpy.c
  2. 2 2
      src/stdlib/SDL_memmove.c
  3. 4 2
      src/stdlib/SDL_memset.c

+ 4 - 2
src/stdlib/SDL_memcpy.c

@@ -69,8 +69,10 @@ void *SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void
         switch (left) {
         case 3:
             *dstp1++ = *srcp1++;
+            SDL_FALLTHROUGH;
         case 2:
             *dstp1++ = *srcp1++;
+            SDL_FALLTHROUGH;
         case 1:
             *dstp1++ = *srcp1++;
         }
@@ -84,11 +86,11 @@ void *SDL_memcpy(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void
 #ifndef HAVE_LIBC
 /* NOLINTNEXTLINE(readability-redundant-declaration) */
 extern void *memcpy(void *dst, const void *src, size_t len);
-#ifndef __INTEL_LLVM_COMPILER
+#if defined(_MSC_VER) && !defined(__INTEL_LLVM_COMPILER)
 #pragma intrinsic(memcpy)
 #endif
 
-#ifndef __clang__
+#if defined(_MSC_VER) && !defined(__clang__)
 #pragma function(memcpy)
 #endif
 /* NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) */

+ 2 - 2
src/stdlib/SDL_memmove.c

@@ -57,11 +57,11 @@ void *SDL_memmove(SDL_OUT_BYTECAP(len) void *dst, SDL_IN_BYTECAP(len) const void
 #ifndef HAVE_LIBC
 /* NOLINTNEXTLINE(readability-redundant-declaration) */
 extern void *memmove(void *dst, const void *src, size_t len);
-#ifndef __INTEL_LLVM_COMPILER
+#if defined(_MSC_VER) && !defined(__INTEL_LLVM_COMPILER)
 #pragma intrinsic(memmove)
 #endif
 
-#ifndef __clang__
+#if defined(_MSC_VER) && !defined(__clang__)
 #pragma function(memmove)
 #endif
 /* NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) */

+ 4 - 2
src/stdlib/SDL_memset.c

@@ -67,8 +67,10 @@ void *SDL_memset(SDL_OUT_BYTECAP(len) void *dst, int c, size_t len)
     switch (left) {
     case 3:
         *dstp1++ = value1;
+        SDL_FALLTHROUGH;
     case 2:
         *dstp1++ = value1;
+        SDL_FALLTHROUGH;
     case 1:
         *dstp1++ = value1;
     }
@@ -121,11 +123,11 @@ void *SDL_memset4(void *dst, Uint32 val, size_t dwords)
 #ifndef HAVE_LIBC
 /* NOLINTNEXTLINE(readability-redundant-declaration) */
 extern void *memset(void *dst, int c, size_t len);
-#ifndef __INTEL_LLVM_COMPILER
+#if defined(_MSC_VER) && !defined(__INTEL_LLVM_COMPILER)
 #pragma intrinsic(memset)
 #endif
 
-#ifndef __clang__
+#if defined(_MSC_VER) && !defined(__clang__)
 #pragma function(memset)
 #endif
 /* NOLINTNEXTLINE(readability-inconsistent-declaration-parameter-name) */