]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-99069: Consolidate checks for static_assert (GH-94766)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 5 Apr 2023 15:44:13 +0000 (08:44 -0700)
committerGitHub <noreply@github.com>
Wed, 5 Apr 2023 15:44:13 +0000 (08:44 -0700)
commit851e74441e5264bf2bd1383d053de2196e157140
tree639d2a7b3f711fdd48be8e0a4de9ed4f3cff0e4b
parent09fb27fa51aeafbc61a51c5e748c97b18d907c8b
gh-99069: Consolidate checks for static_assert (GH-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.

(cherry picked from commit 96e1901a59ed3bb6188743d60395666969a3ba42)

Co-authored-by: Joshua Root <jmr@macports.org>
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]