Skip to content

Commit

Permalink
[3.12] pythongh-118124: fix assert related C++ checks on Solaris/Illu…
Browse files Browse the repository at this point in the history
…mos (pythonGH-121974) (python#122109)

Fix check for static_assert() for C++ on some platforms..
(cherry picked from commit e88bd96)
  • Loading branch information
kulikjak authored Jul 22, 2024
1 parent 71970d6 commit 6586b17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Include/pymacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
// MSVC makes static_assert a keyword in C11-17, contrary to the standards.
//
// In C++11 and C2x, static_assert is a keyword, redefining is undefined
// behaviour. So only define if building as C (if __STDC_VERSION__ is defined),
// not C++, and only for C11-17.
// behaviour. So only define if building as C, not C++ (if __cplusplus is
// not defined), and only for C11-17.
#if !defined(static_assert) && (defined(__GNUC__) || defined(__clang__)) \
&& defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L \
&& __STDC_VERSION__ <= 201710L
&& !defined(__cplusplus) && defined(__STDC_VERSION__) \
&& __STDC_VERSION__ >= 201112L && __STDC_VERSION__ <= 201710L
# define static_assert _Static_assert
#endif

Expand Down

0 comments on commit 6586b17

Please sign in to comment.