Commit 3bb183d7 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)

Partially revert commit 5f2df88b:
add "#undef Yield" to .c files after including Python-ast.h.

Fix the warning:

    winbase.h(102): warning C4005: 'Yield': macro redefinition
parent 2cf5d32f
...@@ -8,7 +8,7 @@ extern "C" { ...@@ -8,7 +8,7 @@ extern "C" {
#include "asdl.h" #include "asdl.h"
#undef Yield /* undefine macro conflicting with winbase.h */ #undef Yield /* undefine macro conflicting with <winbase.h> */
typedef struct _mod *mod_ty; typedef struct _mod *mod_ty;
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "Python.h" /* general Python API */ #include "Python.h" /* general Python API */
#include "Python-ast.h" /* mod_ty */ #include "Python-ast.h" /* mod_ty */
#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "ast.h" #include "ast.h"
#include "graminit.h" /* symbols defined in the grammar */ #include "graminit.h" /* symbols defined in the grammar */
#include "node.h" /* internal parser structure */ #include "node.h" /* internal parser structure */
......
...@@ -1247,7 +1247,7 @@ def main(srcfile, dump_module=False): ...@@ -1247,7 +1247,7 @@ def main(srcfile, dump_module=False):
f.write('\n') f.write('\n')
f.write('#include "asdl.h"\n') f.write('#include "asdl.h"\n')
f.write('\n') f.write('\n')
f.write('#undef Yield /* undefine macro conflicting with winbase.h */\n') f.write('#undef Yield /* undefine macro conflicting with <winbase.h> */\n')
f.write('\n') f.write('\n')
c = ChainOfVisitors(TypeDefVisitor(f), c = ChainOfVisitors(TypeDefVisitor(f),
StructVisitor(f), StructVisitor(f),
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "Python.h" #include "Python.h"
#include <ctype.h> #include <ctype.h>
#include "ast.h" #include "ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_pystate.h" #include "pycore_pystate.h"
_Py_IDENTIFIER(__builtins__); _Py_IDENTIFIER(__builtins__);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "Python.h" #include "Python.h"
#include "Python-ast.h" #include "Python-ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_pyhash.h" #include "pycore_pyhash.h"
#include "pycore_pylifecycle.h" #include "pycore_pylifecycle.h"
#include "pycore_pymem.h" #include "pycore_pymem.h"
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "Python.h" #include "Python.h"
#include "Python-ast.h" #include "Python-ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_context.h" #include "pycore_context.h"
#include "pycore_hamt.h" #include "pycore_hamt.h"
#include "pycore_pathconfig.h" #include "pycore_pathconfig.h"
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "Python.h" #include "Python.h"
#include "Python-ast.h" #include "Python-ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_pystate.h" #include "pycore_pystate.h"
#include "grammar.h" #include "grammar.h"
#include "node.h" #include "node.h"
......
#include "Python.h" #include "Python.h"
#include "pycore_pystate.h" #include "pycore_pystate.h"
#include "symtable.h" #include "symtable.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "structmember.h" #include "structmember.h"
/* error strings used for warnings */ /* error strings used for warnings */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment