gh-91731: Add macro compatibility for static_assert for old libcs#92559
gh-91731: Add macro compatibility for static_assert for old libcs#92559pablogsal merged 6 commits intopython:mainfrom
Conversation
Include/pymacro.h
Outdated
| #if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ <= 16 | ||
| # define static_assert _Static_assert | ||
| #endif | ||
| + |
There was a problem hiding this comment.
I believe you left a stray + from a diff in there
vstinner
left a comment
There was a problem hiding this comment.
I'm sad that FreeBSD and old glibc requires these workarounds, I expected that "C11" means "static_assert() is usable". But well, the real world is more complicated.
An alternative would be to define Py_static_assert(), but I prefer to use standard static_assert() name and hope that in a few years (20 years? :-D), we can remove these workaround for old platforms. The only drawback is that including <Python.h> defines static_assert(), but IMO it's an acceptable trade-off.
Co-authored-by: Victor Stinner <vstinner@python.org>
|
I took the liberty of pushing directly changes to fix typos (and reindent the long condition) in your PR using the GitHub suggestion tool. |
vstinner
left a comment
There was a problem hiding this comment.
LGTM.
IMO it's acceptable to have such code for old glibc versions, as I did for old FreeBSD versions.
|
Thanks @pablogsal for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
|
GH-92566 is a backport of this pull request to the 3.11 branch. |
…cs (pythonGH-92559) (cherry picked from commit f0614ca) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
|
Thanks for the fix ;-) |
| # define static_assert _Static_assert | ||
| #endif | ||
|
|
||
| // static_assert is defined in GLIB from version 2.16. Before it requires |
There was a problem hiding this comment.
GLIBC? (GLIB exists, but it's something quite different.)
There was a problem hiding this comment.
That's a typo, indeed. It should be GLIBC
No description provided.