-
-
Notifications
You must be signed in to change notification settings - Fork 29.4k
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
Python 3.11 C API is not compatible with ISO C90: ISO C90 forbids mixed declarations and code #92781
Comments
Avoid mixing declarations and code in the C API to fix the compiler warning: "ISO C90 forbids mixed declarations and code" [-Werror=declaration-after-statement].
PostgreSQL is another package that uses |
Are there more intermingled declarations left in the public headers, Victor? If not, we can close this issue :) |
Issue fixed by #92783 |
On Fedora, building the xen package with Python 3.11 fails with C compiler errors like:
See: https://bugzilla.redhat.com/show_bug.cgi?id=2084008#c0
In Python 3.11, PEP 670 converts multiple macros to static inline functions. A C11 compiler (without optional features) is now required to build Python 3.11.
In 2022, most C compilers support C99 which supports mixed declarations and code, so I don't understand why people insist on using
-Werror=declaration-after-statement
. Maybe it's more a coding style, than a technical requirement. Or maybe it prevented compiler errors on old C compilers a few years ago, and nobody considered removing the compiler flag since that old time.We can try to stay somehow compatible with ISO C90 in Python 3.11. Avoid "mixed declarations and code" in static inline functions requires minimum changes and so IMO is acceptable.
The text was updated successfully, but these errors were encountered: