You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add missing dependencies between AST/parser header files #79358
Currently, there are *implicit* dependencies between AST/parser header files. For example, ast.h uses node and mod_ty types but don't include node.h nor Python-ast.h. And parsetok.h uses node and grammer but don't include nor grammar.h.
Because of that, C files have to include header files in the "correct order" and need to include header files even if they don't use directly.
Activity
vstinner commentedon Nov 6, 2018
Currently, there are *implicit* dependencies between AST/parser header files. For example, ast.h uses node and mod_ty types but don't include node.h nor Python-ast.h. And parsetok.h uses node and grammer but don't include nor grammar.h.
Because of that, C files have to include header files in the "correct order" and need to include header files even if they don't use directly.
At the end, we get something like pythonrun.c:
whereas most header files are useless, pythonrun.c still compiles with:
I propose to add explicit dependencies in header files directly, rather than using black magic in C files.
Attached PR fix this issue.
vstinner commentedon Nov 11, 2018
New changeset 5f2df88 by Victor Stinner in branch 'master':
bpo-35177: Add dependencies between header files (GH-10361)
5f2df88
vstinner commentedon Nov 12, 2018
This change doesn't try to fix "all dependencies issues", but it fix a few of them :-) See bpo-35197 for another example of funny header issue.
Please open a new issues if you see other header dependencies issues. I close this one since the initial bug has been fixed.
vstinner commentedon Nov 12, 2018
Oh, the Yield warning made its come back :-( Example:
import.c
c:\program files (x86)\windows kits\10\include\10.0.17134.0\um\winbase.h(102): warning C4005: 'Yield': macro redefinition [C:\projects\cpython\PCbuild\pythoncore.vcxproj]
c:\projects\cpython\include\python-ast.h(549): note: see previous definition of 'Yield'
vstinner commentedon Nov 22, 2018
New changeset 3bb183d by Victor Stinner in branch 'master':
bpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)
3bb183d
vstinner commentedon Nov 22, 2018
Ok, I fixed the "Yield warning" again.