Skip to content

Commit

Permalink
SDL_stdinc.h (SDL_COMPILE_TIME_ASSERT): Keep C++ case alone (after PR…
Browse files Browse the repository at this point in the history
…/10331)

Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode.
Reference issue: libsdl-org#6078 which was fixed by
libsdl-org@f6b8112
  • Loading branch information
sezero committed Jul 22, 2024
1 parent 230f2a6 commit 70c1012
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/SDL3/SDL_stdinc.h
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,12 @@ typedef Sint64 SDL_Time;
#endif /* SDL_DISABLE_ANALYZE_MACROS */

#ifndef SDL_COMPILE_TIME_ASSERT
#if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L)
#if defined(__cplusplus)
/* Keep C++ case alone: Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode. */
#if (__cplusplus >= 201103L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#endif
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 202311L)
#define SDL_COMPILE_TIME_ASSERT(name, x) static_assert(x, #x)
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
#define SDL_COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
Expand Down

0 comments on commit 70c1012

Please sign in to comment.