mirror of https://github.com/python/cpython.git
gh-130740: Move some `stdbool.h` includes after `Python.h` (#130738)
Move some `#include <stdbool.h>` after `#include "Python.h"` when `pyconfig.h` is not
included first and when we are in a platform-agnostic context. This is to avoid having
features defined by `stdbool.h` before those decided by `Python.h` (this caused some
build failures when compiling CPython with `zig cc`).
(cherry-picked from commit 214562ed4d
)
---------
Co-authored-by: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
This commit is contained in:
parent
9643ce9019
commit
00cf2a621a
|
@ -0,0 +1,2 @@
|
|||
Ensure that ``Python.h`` is included before ``stdbool.h`` unless ``pyconfig.h``
|
||||
is included before or in some platform-specific contexts.
|
|
@ -17,10 +17,11 @@
|
|||
# define Py_BUILD_CORE_MODULE 1
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "Python.h"
|
||||
#include "pycore_strhex.h" // _Py_strhex()
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "../hashlib.h"
|
||||
#include "blake2module.h"
|
||||
|
||||
|
|
|
@ -17,10 +17,11 @@
|
|||
# define Py_BUILD_CORE_MODULE 1
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "Python.h"
|
||||
#include "pycore_strhex.h" // _Py_strhex()
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "../hashlib.h"
|
||||
#include "blake2module.h"
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
# define Py_BUILD_CORE_MODULE 1
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "Python.h"
|
||||
#include "pycore_hashtable.h"
|
||||
#include "pycore_pyhash.h" // _Py_HashBytes()
|
||||
|
@ -38,6 +37,7 @@
|
|||
#include <openssl/objects.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifndef OPENSSL_THREADS
|
||||
# error "OPENSSL_THREADS is not defined, Python requires thread-safe OpenSSL"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#include <Python.h>
|
||||
#include "pycore_bytesobject.h" // _PyBytes_DecodeEscape()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_DecodeUnicodeEscapeInternal()
|
||||
|
@ -8,6 +6,8 @@
|
|||
#include "pegen.h"
|
||||
#include "string_parser.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
//// STRING HANDLING FUNCTIONS ////
|
||||
|
||||
static int
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Python.h"
|
||||
#include "pycore_flowgraph.h"
|
||||
#include "pycore_compile.h"
|
||||
|
@ -9,6 +6,8 @@
|
|||
#include "pycore_opcode_utils.h"
|
||||
#include "pycore_opcode_metadata.h" // OPCODE_HAS_ARG, etc
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
#undef SUCCESS
|
||||
#undef ERROR
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
*/
|
||||
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Python.h"
|
||||
|
||||
#include "pycore_compile.h" // _PyCompile_EnsureArrayLargeEnough
|
||||
|
@ -22,6 +20,8 @@ typedef _Py_SourceLocation location;
|
|||
|
||||
#include "clinic/instruction_sequence.c.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#undef SUCCESS
|
||||
#undef ERROR
|
||||
#define SUCCESS 0
|
||||
|
|
Loading…
Reference in New Issue