[Python-checkins] bpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)
Victor Stinner
webhook-mailer at python.org
Thu Nov 22 12:38:41 EST 2018
https://github.com/python/cpython/commit/3bb183d7fb83ad6a84ec13dea90f95d67be35c69
commit: 3bb183d7fb83ad6a84ec13dea90f95d67be35c69
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-11-22T18:38:38+01:00
summary:
bpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)
Partially revert commit 5f2df88b63e50d23914e97ec778861a52abdeaad:
add "#undef Yield" to .c files after including Python-ast.h.
Fix the warning:
winbase.h(102): warning C4005: 'Yield': macro redefinition
files:
M Include/Python-ast.h
M Modules/parsermodule.c
M Parser/asdl_c.py
M Python/bltinmodule.c
M Python/import.c
M Python/pylifecycle.c
M Python/pythonrun.c
M Python/symtable.c
diff --git a/Include/Python-ast.h b/Include/Python-ast.h
index 1b7d9b10b1a5..1a2b8297810c 100644
--- a/Include/Python-ast.h
+++ b/Include/Python-ast.h
@@ -8,7 +8,7 @@ extern "C" {
#include "asdl.h"
-#undef Yield /* undefine macro conflicting with winbase.h */
+#undef Yield /* undefine macro conflicting with <winbase.h> */
typedef struct _mod *mod_ty;
diff --git a/Modules/parsermodule.c b/Modules/parsermodule.c
index df239d67b2f7..c8fb3d21771b 100644
--- a/Modules/parsermodule.c
+++ b/Modules/parsermodule.c
@@ -32,6 +32,7 @@
#include "Python.h" /* general Python API */
#include "Python-ast.h" /* mod_ty */
+#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "ast.h"
#include "graminit.h" /* symbols defined in the grammar */
#include "node.h" /* internal parser structure */
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 6a8262c73b31..75fb78b9c94e 100644
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -1247,7 +1247,7 @@ def main(srcfile, dump_module=False):
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('#undef Yield /* undefine macro conflicting with <winbase.h> */\n')
f.write('\n')
c = ChainOfVisitors(TypeDefVisitor(f),
StructVisitor(f),
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 14550fd233f4..f0d342ae92d2 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -3,6 +3,7 @@
#include "Python.h"
#include <ctype.h>
#include "ast.h"
+#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_pystate.h"
_Py_IDENTIFIER(__builtins__);
diff --git a/Python/import.c b/Python/import.c
index f7c37aa353c8..15637c6a1f31 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -3,6 +3,7 @@
#include "Python.h"
#include "Python-ast.h"
+#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_pyhash.h"
#include "pycore_pylifecycle.h"
#include "pycore_pymem.h"
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 58e16473100e..af3d5ef055fa 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -3,6 +3,7 @@
#include "Python.h"
#include "Python-ast.h"
+#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_context.h"
#include "pycore_hamt.h"
#include "pycore_pathconfig.h"
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 1bf822ceadb4..2d5dc88c5c76 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -11,6 +11,7 @@
#include "Python.h"
#include "Python-ast.h"
+#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_pystate.h"
#include "grammar.h"
#include "node.h"
diff --git a/Python/symtable.c b/Python/symtable.c
index 96f7bcda5e26..677b6043438e 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1,6 +1,7 @@
#include "Python.h"
#include "pycore_pystate.h"
#include "symtable.h"
+#undef Yield /* undefine macro conflicting with <winbase.h> */
#include "structmember.h"
/* error strings used for warnings */
More information about the Python-checkins
mailing list