SDL: Fix warnings when building with -DSDL_LIBC=OFF on Linux

From 009318c5a9d491749f2de23a3b607b8d17ee28db Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Mon, 18 Mar 2024 20:39:47 +0100
Subject: [PATCH] Fix warnings when building with -DSDL_LIBC=OFF on Linux

---
 src/stdlib/SDL_memcpy.c  | 6 ++++--
 src/stdlib/SDL_memmove.c | 4 ++--
 src/stdlib/SDL_memset.c  | 6 ++++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/stdlib/SDL_memcpy.c b/src/stdlib/SDL_memcpy.c
index 36a2bceaaaab3..6c6457652de73 100644
--- a/src/stdlib/SDL_memcpy.c
+++ b/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) */
diff --git a/src/stdlib/SDL_memmove.c b/src/stdlib/SDL_memmove.c
index 38a75e0f2aeff..db5d319466d0b 100644
--- a/src/stdlib/SDL_memmove.c
+++ b/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) */
diff --git a/src/stdlib/SDL_memset.c b/src/stdlib/SDL_memset.c
index 90ecbeedd3872..2103ff183f500 100644
--- a/src/stdlib/SDL_memset.c
+++ b/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) */