You can't combine SDL_STRINGIFY_ARG() and SDL_FUNCTION

Removed obsolete documentation that shows this usage and macros that attempt it.

Also allow SDL_FUNCTION to be redefined by the application.

Fixes https://github.com/libsdl-org/SDL/issues/15004

(cherry picked from commit 6feb0e1333)
(cherry picked from commit cbd2917324)
(cherry picked from commit f689caed82)
This commit is contained in:
Sam Lantinga
2026-02-08 10:51:43 -08:00
committed by Ozkan Sezer
parent 7d4c119d17
commit 10a82990ee
9 changed files with 96 additions and 126 deletions

View File

@@ -163,7 +163,7 @@ extern "C" {
#ifdef SDL_WIKI_DOCUMENTATION_SECTION
/**
* A macro that reports the current function being compiled.
* A constant that contains the current function being compiled.
*
* If SDL can't figure how the compiler reports this, it will use "???".
*
@@ -171,13 +171,15 @@ extern "C" {
*/
#define SDL_FUNCTION __FUNCTION__
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
#elif !defined(SDL_FUNCTION)
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */
# define SDL_FUNCTION __func__
#elif ((defined(__GNUC__) && (__GNUC__ >= 2)) || defined(_MSC_VER) || defined (__WATCOMC__))
# define SDL_FUNCTION __FUNCTION__
#else
# define SDL_FUNCTION "???"
#endif
#endif
/**
* A macro that reports the current file being compiled.

View File

@@ -227,12 +227,6 @@ void *alloca(size_t);
/**
* Macro useful for building other macros with strings in them.
*
* For example:
*
* ```c
* #define LOG_ERROR(X) OutputDebugString(SDL_STRINGIFY_ARG(__FUNCTION__) ": " X "\n")`
* ```
*
* \param arg the text to turn into a string literal.
*
* \since This macro is available since SDL 3.2.0.