]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-99069: Consolidate checks for static_assert (#94766)
authorJoshua Root <jmr@macports.org>
Wed, 5 Apr 2023 15:09:19 +0000 (01:09 +1000)
committerGitHub <noreply@github.com>
Wed, 5 Apr 2023 15:09:19 +0000 (17:09 +0200)
commit96e1901a59ed3bb6188743d60395666969a3ba42
tree853592ba45df1fd29389ad44cd98cf25eb7a1a44
parentfdd0fff277a55c010a4da0a7af0e986e38560545
gh-99069: Consolidate checks for static_assert (#94766)

Several platforms don't define the static_assert macro despite having
compiler support for the _Static_assert keyword. The macro needs to be
defined since it is used unconditionally in the Python code. So it
should always be safe to define it if undefined and not in C++11 (or
later) mode.

Hence, remove the checks for particular platforms or libc versions,
and just define static_assert anytime it needs to be defined but isn't.
That way, all platforms that need the fix will get it, regardless of
whether someone specifically thought of them.

Also document that certain macOS versions are among the platforms that
need this.

The C2x draft (currently expected to become C23) makes static_assert
a keyword to match C++. So only define the macro for up to C17.

Co-authored-by: Victor Stinner <vstinner@python.org>
Include/pymacro.h
Misc/NEWS.d/next/Build/2023-02-11-05-31-05.gh-issue-99069.X4LDvY.rst [new file with mode: 0644]