From 72880d875ea1429e9e4d2299af730a78bd746c8a Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 14 May 2026 17:36:57 +0200 Subject: [PATCH 1/4] stdinc: _Countof is only available in C mode --- include/SDL3/SDL_stdinc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/SDL3/SDL_stdinc.h b/include/SDL3/SDL_stdinc.h index 3e2266dc8f65a..893f2052f7dc2 100644 --- a/include/SDL3/SDL_stdinc.h +++ b/include/SDL3/SDL_stdinc.h @@ -256,7 +256,7 @@ void *alloca(size_t); #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) /* or `_Countof(array)` on recent gcc and clang */ #else -#if (defined(__GNUC__) && __GNUC__ >= 16) || SDL_HAS_EXTENSION(c_countof) +#if !defined(__cplusplus) && ((defined(__GNUC__) && __GNUC__ >= 16) || SDL_HAS_EXTENSION(c_countof)) #define SDL_arraysize(array) _Countof(array) #else #define SDL_arraysize(array) (sizeof(array)/sizeof(array[0])) From 009e42a7f6c87e8e07b101b85bdcc5551ee2095c Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 14 May 2026 17:37:14 +0200 Subject: [PATCH 2/4] cmake: gameinput.h is a c++-only header --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 851e11add9e85..cf8767121676f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,6 +50,7 @@ include(CheckIncludeFiles) include(CheckLanguage) include(CheckSymbolExists) include(CheckCSourceCompiles) +include(CheckCXXSourceCompiles) include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) @@ -2314,7 +2315,7 @@ elseif(WINDOWS) static __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2; int main(int argc, char **argv) { return 0; }" HAVE_WINDOWS_GAMING_INPUT_H ) - check_c_source_compiles(" + check_cxx_source_compiles(" #include #define COBJMACROS #include From 96c6f6eac2fb18ce9ec7725ccc41060757857d20 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 14 May 2026 17:38:30 +0200 Subject: [PATCH 3/4] gameinput.h emits a few Wundef warnings (WINAPI_PARTITION_* macros) --- src/core/windows/SDL_gameinput.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/windows/SDL_gameinput.h b/src/core/windows/SDL_gameinput.h index 0d7b6f85e74de..d283831ff14e1 100644 --- a/src/core/windows/SDL_gameinput.h +++ b/src/core/windows/SDL_gameinput.h @@ -25,8 +25,17 @@ #ifdef HAVE_GAMEINPUT_H +#ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wundef" +#endif + #include +#ifdef HAVE_GCC_DIAGNOSTIC_PRAGMA +#pragma GCC diagnostic pop +#endif + #ifndef GAMEINPUT_API_VERSION #define GAMEINPUT_API_VERSION 0 #endif From 62716d707054da93a6d09a3cbf514788f310ac92 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Thu, 14 May 2026 17:40:13 +0200 Subject: [PATCH 4/4] gameinputjoystick: %02hhX emits a -Wformat warning --- src/joystick/gdk/SDL_gameinputjoystick.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/joystick/gdk/SDL_gameinputjoystick.cpp b/src/joystick/gdk/SDL_gameinputjoystick.cpp index 5f41f2864f3c7..f05c62c487b6f 100644 --- a/src/joystick/gdk/SDL_gameinputjoystick.cpp +++ b/src/joystick/gdk/SDL_gameinputjoystick.cpp @@ -280,7 +280,7 @@ static bool GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice) // Generate a device path for (idx = 0; idx < APP_LOCAL_DEVICE_ID_SIZE; ++idx) { - SDL_snprintf(tmp, SDL_arraysize(tmp), "%02hhX", info->deviceId.value[idx]); + SDL_snprintf(tmp, SDL_arraysize(tmp), "%02X", info->deviceId.value[idx]); SDL_strlcat(elem->path, tmp, SDL_arraysize(elem->path)); }