-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-91731: Add macro compatibility for static_assert for old libcs #92559
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you left a stray +
from a diff in there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whops!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
I took the liberty of pushing directly changes to fix typos (and reindent the long condition) in your PR using the GitHub suggestion tool. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 <[email protected]>
…-92559) (#92566) (cherry picked from commit f0614ca) Co-authored-by: Pablo Galindo Salgado <[email protected]> Co-authored-by: Pablo Galindo Salgado <[email protected]>
Thanks for the fix ;-) |
@@ -10,6 +10,14 @@ | |||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GLIBC? (GLIB exists, but it's something quite different.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a typo, indeed. It should be GLIBC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in #92618
No description provided.