Skip to content

Commit

Permalink
bpo-35177, Python-ast.h: Fix "Yield" compiler warning (GH-10664)
Browse files Browse the repository at this point in the history
Partially revert commit 5f2df88:
add "#undef Yield" to .c files after including Python-ast.h.

Fix the warning:

    winbase.h(102): warning C4005: 'Yield': macro redefinition
  • Loading branch information
vstinner authored Nov 22, 2018
1 parent 2cf5d32 commit 3bb183d
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Include/Python-ast.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Modules/parsermodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion Parser/asdl_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions Python/bltinmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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__);
Expand Down
1 change: 1 addition & 0 deletions Python/import.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions Python/pylifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions Python/pythonrun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions Python/symtable.c
Original file line number Diff line number Diff line change
@@ -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 */
Expand Down

0 comments on commit 3bb183d

Please sign in to comment.