diff options
author | Victor Stinner <vstinner@python.org> | 2023-09-30 20:06:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-30 20:06:45 (GMT) |
commit | 7513994c927857679544449392744be308d36586 (patch) | |
tree | 7d8bf43e49011f210dac2d282223aa1ee88f7d01 /Include/cpython | |
parent | 0def8c712bb6f66f1081cab71deb3681566b846d (diff) | |
download | cpython-7513994c927857679544449392744be308d36586.zip cpython-7513994c927857679544449392744be308d36586.tar.gz cpython-7513994c927857679544449392744be308d36586.tar.bz2 |
gh-110014: Include explicitly <unistd.h> header (#110155)
* Remove unused <locale.h> includes.
* Remove unused <fcntl.h> include in traceback.h.
* Remove redundant <assert.h> and <stddef.h> includes. They are already
included by "Python.h".
* Remove <object.h> include in faulthandler.c. Python.h already includes it.
* Add missing <stdbool.h> in pycore_pythread.h if HAVE_PTHREAD_STUBS
is defined.
* Fix also warnings in pthread_stubs.h: don't redefine macros if they
are already defined, like the __NEED_pthread_t macro.
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/pthread_stubs.h | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/Include/cpython/pthread_stubs.h b/Include/cpython/pthread_stubs.h index d95ee03..5246968 100644 --- a/Include/cpython/pthread_stubs.h +++ b/Include/cpython/pthread_stubs.h @@ -21,13 +21,29 @@ #ifdef __wasi__ // WASI's bits/alltypes.h provides type definitions when __NEED_ is set. // The header file can be included multiple times. -# define __NEED_pthread_cond_t 1 -# define __NEED_pthread_condattr_t 1 -# define __NEED_pthread_mutex_t 1 -# define __NEED_pthread_mutexattr_t 1 -# define __NEED_pthread_key_t 1 -# define __NEED_pthread_t 1 -# define __NEED_pthread_attr_t 1 +// +// <sys/types.h> may also define these macros. +# ifndef __NEED_pthread_cond_t +# define __NEED_pthread_cond_t 1 +# endif +# ifndef __NEED_pthread_condattr_t +# define __NEED_pthread_condattr_t 1 +# endif +# ifndef __NEED_pthread_mutex_t +# define __NEED_pthread_mutex_t 1 +# endif +# ifndef __NEED_pthread_mutexattr_t +# define __NEED_pthread_mutexattr_t 1 +# endif +# ifndef __NEED_pthread_key_t +# define __NEED_pthread_key_t 1 +# endif +# ifndef __NEED_pthread_t +# define __NEED_pthread_t 1 +# endif +# ifndef __NEED_pthread_attr_t +# define __NEED_pthread_attr_t 1 +# endif # include <bits/alltypes.h> #else typedef struct { void *__x; } pthread_cond_t; |