From 04aa74b5f93a965c34e94728d2d3a64757899061 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Sat, 11 Oct 2025 05:20:20 +0300 Subject: [PATCH] SDL_dlopennote.h: define SDL_DISABLE_DLOPEN_NOTES for old gcc < 3.1 gcc < 3.1 doesn't support 'used' attribute at the least. Also change the SDL_ELF_NOTE_DLOPEN variadic macro for disabled case to be compatible with old gcc versions: tested with gcc-2.95. Old MSVC cases, e.g. VS 2003 and older, are still not resolved. Reference issue: https://github.com/libsdl-org/SDL/issues/14214. --- include/SDL3/SDL_dlopennote.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/SDL3/SDL_dlopennote.h b/include/SDL3/SDL_dlopennote.h index b4e6088523..da145eed5f 100644 --- a/include/SDL3/SDL_dlopennote.h +++ b/include/SDL3/SDL_dlopennote.h @@ -104,6 +104,11 @@ #ifndef SDL_DISABLE_DLOPEN_NOTES #define SDL_DISABLE_DLOPEN_NOTES #endif +#elif defined(__GNUC__) && (__GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 1)) +/* gcc < 3.1 too old */ +#ifndef SDL_DISABLE_DLOPEN_NOTES +#define SDL_DISABLE_DLOPEN_NOTES +#endif #endif /* SDL_PLATFORM_UNIX || SDL_PLATFORM_ANDROID */ #if defined(__ELF__) && !defined(SDL_DISABLE_DLOPEN_NOTES) @@ -204,7 +209,11 @@ "\",\"soname\":" SDL_SONAME_ARRAY(__VA_ARGS__) "}]", \ SDL_ELF_NOTE_UNIQUE_NAME) -#elif (defined (__GNUC__) && __GNUC__ < 3) || (defined(_MSC_VER) && (_MSC_VER < 1400)) +#elif defined(__GNUC__) && __GNUC__ < 3 + +#define SDL_ELF_NOTE_DLOPEN(args...) + +#elif defined(_MSC_VER) && _MSC_VER < 1400 /* Variadic macros are not supported */ #define SDL_ELF_NOTE_DLOPEN