-
-
Notifications
You must be signed in to change notification settings - Fork 31.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
Fix compiler warning on Windows. #18012
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Built without warnings: https://github.com/python/cpython/pull/18012/checks?check_run_id=390916364#step:3:567 |
zware
approved these changes
Jan 15, 2020
Thanks @ammaraskar for the PR, and @zware for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8. |
GH-18014 is a backport of this pull request to the 3.8 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jan 15, 2020
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. (cherry picked from commit e92d393) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
miss-islington
added a commit
that referenced
this pull request
Jan 15, 2020
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. (cherry picked from commit e92d393) Co-authored-by: Ammar Askar <ammar@ammaraskar.com>
shihai1991
pushed a commit
to shihai1991/cpython
that referenced
this pull request
Jan 31, 2020
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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Looks like c96be811fa7da8ddcea18cc7 introduced an include for
pycore_pystate.h
incompile.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#L12we 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