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:
Victor Stinner 2018-11-12 00:56:19 +01:00 committed by GitHub
parent fd3a91cbf9
commit 5f2df88b63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 42 additions and 26 deletions

View file

@ -32,15 +32,14 @@
#include "Python.h" /* general Python API */
#include "Python-ast.h" /* mod_ty */
#include "ast.h"
#include "graminit.h" /* symbols defined in the grammar */
#include "node.h" /* internal parser structure */
#include "errcode.h" /* error codes for PyNode_*() */
#include "token.h" /* token definitions */
/* ISTERMINAL() / ISNONTERMINAL() */
#include "grammar.h"
#include "parsetok.h"
/* ISTERMINAL() / ISNONTERMINAL() */
#undef Yield
#include "ast.h"
extern grammar _PyParser_Grammar; /* From graminit.c */