summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-11 23:56:19 (GMT)
committerGitHub <noreply@github.com>2018-11-11 23:56:19 (GMT)
commit5f2df88b63e50d23914e97ec778861a52abdeaad (patch)
tree23a720832fb9de901538ca03819946df679ff2cd /Include
parentfd3a91cbf93dd7bd97f01add9c90075d63cd7316 (diff)
downloadcpython-5f2df88b63e50d23914e97ec778861a52abdeaad.zip
cpython-5f2df88b63e50d23914e97ec778861a52abdeaad.tar.gz
cpython-5f2df88b63e50d23914e97ec778861a52abdeaad.tar.bz2
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
Diffstat (limited to 'Include')
-rw-r--r--Include/Python-ast.h13
-rw-r--r--Include/ast.h3
-rw-r--r--Include/parsetok.h5
-rw-r--r--Include/symtable.h5
4 files changed, 23 insertions, 3 deletions
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index 2913d1d..1b7d9b1 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -1,7 +1,15 @@
/* File automatically generated by Parser/asdl_c.py. */
+#ifndef Py_PYTHON_AST_H
+#define Py_PYTHON_AST_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#include "asdl.h"
+#undef Yield /* undefine macro conflicting with winbase.h */
+
typedef struct _mod *mod_ty;
typedef struct _stmt *stmt_ty;
@@ -607,3 +615,8 @@ withitem_ty _Py_withitem(expr_ty context_expr, expr_ty optional_vars, PyArena
PyObject* PyAST_mod2obj(mod_ty t);
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode);
int PyAST_Check(PyObject* obj);
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !Py_PYTHON_AST_H */
diff --git a/Include/ast.h b/Include/ast.h
index c824554..f1d7348 100644
--- a/Include/ast.h
+++ b/Include/ast.h
@@ -4,6 +4,9 @@
extern "C" {
#endif
+#include "Python-ast.h" /* mod_ty */
+#include "node.h" /* node */
+
PyAPI_FUNC(int) PyAST_Validate(mod_ty);
PyAPI_FUNC(mod_ty) PyAST_FromNode(
const node *n,
diff --git a/Include/parsetok.h b/Include/parsetok.h
index c9407a3..1217c46 100644
--- a/Include/parsetok.h
+++ b/Include/parsetok.h
@@ -1,5 +1,5 @@
-
/* Parser-tokenizer link interface */
+
#ifndef Py_LIMITED_API
#ifndef Py_PARSETOK_H
#define Py_PARSETOK_H
@@ -7,6 +7,9 @@
extern "C" {
#endif
+#include "grammar.h" /* grammar */
+#include "node.h" /* node */
+
typedef struct {
int error;
#ifndef PGEN
diff --git a/Include/symtable.h b/Include/symtable.h
index 007f88d..949022b 100644
--- a/Include/symtable.h
+++ b/Include/symtable.h
@@ -1,11 +1,12 @@
#ifndef Py_LIMITED_API
#ifndef Py_SYMTABLE_H
#define Py_SYMTABLE_H
-
#ifdef __cplusplus
extern "C" {
#endif
+#include "Python-ast.h" /* mod_ty */
+
/* XXX(ncoghlan): This is a weird mix of public names and interpreter internal
* names.
*/
@@ -115,4 +116,4 @@ PyAPI_FUNC(void) PySymtable_Free(struct symtable *);
}
#endif
#endif /* !Py_SYMTABLE_H */
-#endif /* Py_LIMITED_API */
+#endif /* !Py_LIMITED_API */