Message329359
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:
#include "Python-ast.h"
#include "pycore_state.h"
#include "grammar.h"
#include "node.h"
#include "token.h"
#include "parsetok.h"
#include "errcode.h"
#include "code.h"
#include "symtable.h"
#include "ast.h"
#include "marshal.h"
#include "osdefs.h"
#include <locale.h>
whereas most header files are useless, pythonrun.c still compiles with:
#include "pycore_state.h"
#include "token.h" /* INDENT in err_input() */
#include "parsetok.h" /* PyParser_ParseFileObject() */
#include "errcode.h" /* E_EOF */
#include "symtable.h" /* PySymtable_BuildObject() */
#include "ast.h" /* PyAST_FromNodeObject() */
#include "marshal.h" /* PyMarshal_ReadLongFromFile */
#include <locale.h>
I propose to add explicit dependencies in header files directly, rather than using black magic in C files.
Attached PR fix this issue. |
|
| Date |
User |
Action |
Args |
| 2018-11-06 14:08:41 | vstinner | set | recipients:
+ vstinner |
| 2018-11-06 14:08:41 | vstinner | set | messageid: <1541513321.28.0.788709270274.issue35177@psf.upfronthosting.co.za> |
| 2018-11-06 14:08:41 | vstinner | link | issue35177 messages |
| 2018-11-06 14:08:41 | vstinner | create | |
|