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

Merged
merged 1 commit into from Jan 15, 2020
Merged

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

@zware
zware approved these changes Jan 15, 2020
@zware zware merged commit e92d393 into python:master Jan 15, 2020
8 checks passed
8 checks passed
Windows (x86)
Details
Windows (x64)
Details
macOS
Details
Ubuntu
Details
Azure Pipelines PR #20200115.13 succeeded
Details
bedevere/issue-number Issue report skipped
bedevere/news "skip news" label found
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@miss-islington

This comment has been minimized.

Copy link

miss-islington commented Jan 15, 2020

Thanks @ammaraskar for the PR, and @zware for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒🤖

@bedevere-bot

This comment has been minimized.

Copy link

bedevere-bot commented Jan 15, 2020

GH-18014 is a backport of this pull request to the 3.8 branch.

miss-islington added 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>
petdance added a commit to petdance/cpython that referenced this pull request Jan 17, 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.
petdance added a commit to petdance/cpython that referenced this pull request Jan 17, 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.
petdance added a commit to petdance/cpython that referenced this pull request Jan 17, 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
Projects
None yet
5 participants
You can’t perform that action at this time.