mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
bpo-35177: Add dependencies between header files (GH-10361)
* ast.h now includes Python-ast.h and node.h
* parsetok.h now includes node.h and grammar.h
* symtable.h now includes Python-ast.h
* Modify asdl_c.py to enhance Python-ast.h:
* Add #ifndef/#define Py_PYTHON_AST_H to be able to include the header
twice
* Add "extern { ... }" for C++
* Undefine "Yield" macro conflicting with winbase.h
* Remove "#undef Yield" from C files, it's now done in Python-ast.h
* Remove now useless includes in C files
This commit is contained in:
parent
fd3a91cbf9
commit
5f2df88b63
13 changed files with 42 additions and 26 deletions
|
|
@ -1239,7 +1239,16 @@ def main(srcfile, dump_module=False):
|
|||
if H_FILE:
|
||||
with open(H_FILE, "w") as f:
|
||||
f.write(auto_gen_msg)
|
||||
f.write('#include "asdl.h"\n\n')
|
||||
f.write('#ifndef Py_PYTHON_AST_H\n')
|
||||
f.write('#define Py_PYTHON_AST_H\n')
|
||||
f.write('#ifdef __cplusplus\n')
|
||||
f.write('extern "C" {\n')
|
||||
f.write('#endif\n')
|
||||
f.write('\n')
|
||||
f.write('#include "asdl.h"\n')
|
||||
f.write('\n')
|
||||
f.write('#undef Yield /* undefine macro conflicting with winbase.h */\n')
|
||||
f.write('\n')
|
||||
c = ChainOfVisitors(TypeDefVisitor(f),
|
||||
StructVisitor(f),
|
||||
PrototypeVisitor(f),
|
||||
|
|
@ -1248,6 +1257,11 @@ def main(srcfile, dump_module=False):
|
|||
f.write("PyObject* PyAST_mod2obj(mod_ty t);\n")
|
||||
f.write("mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);\n")
|
||||
f.write("int PyAST_Check(PyObject* obj);\n")
|
||||
f.write('\n')
|
||||
f.write('#ifdef __cplusplus\n')
|
||||
f.write('}\n')
|
||||
f.write('#endif\n')
|
||||
f.write('#endif /* !Py_PYTHON_AST_H */\n')
|
||||
|
||||
if C_FILE:
|
||||
with open(C_FILE, "w") as f:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue