Skip to content
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

Fix compiler warning on Windows. #18012

Open
wants to merge 1 commit into
base: master
from

Conversation

@ammaraskar
Copy link
Member

ammaraskar commented Jan 15, 2020

Looks like c96be81 introduced an include for pycore_pystate.h in compile.c. This file indirectly includes Windows header files through the use of conditional variables.

Since there is a conflict between the Python-ast.h YIELD macro and the windows YIELD macro: https://github.com/python/cpython/blob/master/Include/Python-ast.h#L12

we have to include this file before Windows headers to avoid redeclaring the macro and running into this warning: https://github.com/python/cpython/runs/390843969#step:3:570

Python-ast.h contains a macro named YIELD that conflicts with the YIELD macro
in Windows system headers. While Python-ast.h has an "undef YIELD" directive
to prevent this, it means that Python-ast.h must be included before Windows
header files or we run into a re-declaration warning. In commit c96be81
an include for pycore_pystate.h was added which indirectly includes Windows
header files. In this commit we re-order the includes to fix this warning.
@ammaraskar

This comment has been minimized.

Copy link
Member Author

ammaraskar commented Jan 15, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.