From e7b1ca8eceb8ee49f6e561a05e73d3de4850d775 Mon Sep 17 00:00:00 2001 From: Ozkan Sezer Date: Thu, 1 Oct 2026 23:56:40 +0300 Subject: [PATCH] os2: add gcc-compatible debug_os2 macros --- CMakeLists.txt | 1 + src/core/os2/SDL_os2.h | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a749a25190..3b77a65b23 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2818,6 +2818,7 @@ elseif(PS2) elseif(OS2) list(APPEND EXTRA_CFLAGS "-DOS2EMX_PLAIN_CHAR") + #list(APPEND EXTRA_CFLAGS "-DOS2DEBUG=2") file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/os2/*.c) list(APPEND SOURCE_FILES ${CORE_SOURCES}) diff --git a/src/core/os2/SDL_os2.h b/src/core/os2/SDL_os2.h index 6268ca3674..76e09b785c 100644 --- a/src/core/os2/SDL_os2.h +++ b/src/core/os2/SDL_os2.h @@ -24,7 +24,7 @@ #include "SDL_log.h" #include "SDL_stdinc.h" -#ifdef OS2DEBUG +#if defined(OS2DEBUG) && defined(__WATCOMC__) #if (OS2DEBUG-0 >= 2) # define debug_os2(s,...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, \ __func__ "(): " ##s, ##__VA_ARGS__) @@ -32,6 +32,14 @@ # define debug_os2(s,...) printf(__func__ "(): " ##s "\n", ##__VA_ARGS__) #endif +#elif defined(OS2DEBUG) && defined(__GNUC__) +#if (OS2DEBUG-0 >= 2) +# define debug_os2(s,...) SDL_LogDebug(SDL_LOG_CATEGORY_APPLICATION, \ + "%s(): " s, __func__, ##__VA_ARGS__) +#else +# define debug_os2(s,...) printf("%s(): " s "\n", __func__,##__VA_ARGS__) +#endif + #else /* no debug */ # define debug_os2(s,...) do {} while (0)