mirror of https://github.com/python/cpython
bpo-46670: Test if a macro is defined, not its value (GH-31178)
* audioop.c: #ifdef WORDS_BIGENDIAN * ctypes.h: #ifdef USING_MALLOC_CLOSURE_DOT_C * _ctypes/malloc_closure.c: #ifdef HAVE_FFI_CLOSURE_ALLOC and #ifdef USING_APPLE_OS_LIBFFI * pytime.c: #ifdef __APPLE__ * unicodeobject.c: #ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
This commit is contained in:
parent
097f74a5a3
commit
b556f53785
|
@ -418,7 +418,7 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
#if HAVE_FFI_PREP_CLOSURE_LOC
|
#if HAVE_FFI_PREP_CLOSURE_LOC
|
||||||
# if USING_APPLE_OS_LIBFFI
|
# ifdef USING_APPLE_OS_LIBFFI
|
||||||
# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
|
# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
|
||||||
# else
|
# else
|
||||||
# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME 1
|
# define HAVE_FFI_PREP_CLOSURE_LOC_RUNTIME 1
|
||||||
|
@ -430,7 +430,7 @@ CThunkObject *_ctypes_alloc_callback(PyObject *callable,
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if USING_APPLE_OS_LIBFFI && defined(__arm64__)
|
#if defined(USING_APPLE_OS_LIBFFI) && defined(__arm64__)
|
||||||
PyErr_Format(PyExc_NotImplementedError, "ffi_prep_closure_loc() is missing");
|
PyErr_Format(PyExc_NotImplementedError, "ffi_prep_closure_loc() is missing");
|
||||||
goto error;
|
goto error;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -826,7 +826,7 @@ static int _call_function_pointer(int flags,
|
||||||
cc = FFI_STDCALL;
|
cc = FFI_STDCALL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# if USING_APPLE_OS_LIBFFI
|
# ifdef USING_APPLE_OS_LIBFFI
|
||||||
# define HAVE_FFI_PREP_CIF_VAR_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
|
# define HAVE_FFI_PREP_CIF_VAR_RUNTIME __builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)
|
||||||
# elif HAVE_FFI_PREP_CIF_VAR
|
# elif HAVE_FFI_PREP_CIF_VAR
|
||||||
# define HAVE_FFI_PREP_CIF_VAR_RUNTIME true
|
# define HAVE_FFI_PREP_CIF_VAR_RUNTIME true
|
||||||
|
|
|
@ -362,7 +362,7 @@ PyObject *_ctypes_get_errobj(int **pspace);
|
||||||
extern PyObject *ComError;
|
extern PyObject *ComError;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if USING_MALLOC_CLOSURE_DOT_C
|
#ifdef USING_MALLOC_CLOSURE_DOT_C
|
||||||
void Py_ffi_closure_free(void *p);
|
void Py_ffi_closure_free(void *p);
|
||||||
void *Py_ffi_closure_alloc(size_t size, void** codeloc);
|
void *Py_ffi_closure_alloc(size_t size, void** codeloc);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -91,13 +91,13 @@ static void more_core(void)
|
||||||
/* put the item back into the free list */
|
/* put the item back into the free list */
|
||||||
void Py_ffi_closure_free(void *p)
|
void Py_ffi_closure_free(void *p)
|
||||||
{
|
{
|
||||||
#if HAVE_FFI_CLOSURE_ALLOC
|
#ifdef HAVE_FFI_CLOSURE_ALLOC
|
||||||
#if USING_APPLE_OS_LIBFFI
|
#ifdef USING_APPLE_OS_LIBFFI
|
||||||
if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
|
if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
|
||||||
#endif
|
#endif
|
||||||
ffi_closure_free(p);
|
ffi_closure_free(p);
|
||||||
return;
|
return;
|
||||||
#if USING_APPLE_OS_LIBFFI
|
#ifdef USING_APPLE_OS_LIBFFI
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -109,12 +109,12 @@ void Py_ffi_closure_free(void *p)
|
||||||
/* return one item from the free list, allocating more if needed */
|
/* return one item from the free list, allocating more if needed */
|
||||||
void *Py_ffi_closure_alloc(size_t size, void** codeloc)
|
void *Py_ffi_closure_alloc(size_t size, void** codeloc)
|
||||||
{
|
{
|
||||||
#if HAVE_FFI_CLOSURE_ALLOC
|
#ifdef HAVE_FFI_CLOSURE_ALLOC
|
||||||
#if USING_APPLE_OS_LIBFFI
|
#ifdef USING_APPLE_OS_LIBFFI
|
||||||
if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
|
if (__builtin_available(macos 10.15, ios 13, watchos 6, tvos 13, *)) {
|
||||||
#endif
|
#endif
|
||||||
return ffi_closure_alloc(size, codeloc);
|
return ffi_closure_alloc(size, codeloc);
|
||||||
#if USING_APPLE_OS_LIBFFI
|
#ifdef USING_APPLE_OS_LIBFFI
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -297,7 +297,7 @@ static const int stepsizeTable[89] = {
|
||||||
#define GETINT16(cp, i) GETINTX(int16_t, (cp), (i))
|
#define GETINT16(cp, i) GETINTX(int16_t, (cp), (i))
|
||||||
#define GETINT32(cp, i) GETINTX(int32_t, (cp), (i))
|
#define GETINT32(cp, i) GETINTX(int32_t, (cp), (i))
|
||||||
|
|
||||||
#if WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
#define GETINT24(cp, i) ( \
|
#define GETINT24(cp, i) ( \
|
||||||
((unsigned char *)(cp) + (i))[2] + \
|
((unsigned char *)(cp) + (i))[2] + \
|
||||||
(((unsigned char *)(cp) + (i))[1] << 8) + \
|
(((unsigned char *)(cp) + (i))[1] << 8) + \
|
||||||
|
@ -314,7 +314,7 @@ static const int stepsizeTable[89] = {
|
||||||
#define SETINT16(cp, i, val) SETINTX(int16_t, (cp), (i), (val))
|
#define SETINT16(cp, i, val) SETINTX(int16_t, (cp), (i), (val))
|
||||||
#define SETINT32(cp, i, val) SETINTX(int32_t, (cp), (i), (val))
|
#define SETINT32(cp, i, val) SETINTX(int32_t, (cp), (i), (val))
|
||||||
|
|
||||||
#if WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
#define SETINT24(cp, i, val) do { \
|
#define SETINT24(cp, i, val) do { \
|
||||||
((unsigned char *)(cp) + (i))[2] = (int)(val); \
|
((unsigned char *)(cp) + (i))[2] = (int)(val); \
|
||||||
((unsigned char *)(cp) + (i))[1] = (int)(val) >> 8; \
|
((unsigned char *)(cp) + (i))[1] = (int)(val) >> 8; \
|
||||||
|
|
|
@ -61,7 +61,7 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
|
#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
|
||||||
#include "pycore_fileutils.h" // _Py_LocaleUsesNonUnicodeWchar()
|
# include "pycore_fileutils.h" // _Py_LocaleUsesNonUnicodeWchar()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Uncomment to display statistics on interned strings at exit
|
/* Uncomment to display statistics on interned strings at exit
|
||||||
|
@ -3344,7 +3344,7 @@ PyUnicode_AsWideChar(PyObject *unicode,
|
||||||
}
|
}
|
||||||
unicode_copy_as_widechar(unicode, w, size);
|
unicode_copy_as_widechar(unicode, w, size);
|
||||||
|
|
||||||
#if HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
|
#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
|
||||||
/* Oracle Solaris uses non-Unicode internal wchar_t form for
|
/* Oracle Solaris uses non-Unicode internal wchar_t form for
|
||||||
non-Unicode locales and hence needs conversion first. */
|
non-Unicode locales and hence needs conversion first. */
|
||||||
if (_Py_LocaleUsesNonUnicodeWchar()) {
|
if (_Py_LocaleUsesNonUnicodeWchar()) {
|
||||||
|
@ -3381,7 +3381,7 @@ PyUnicode_AsWideCharString(PyObject *unicode,
|
||||||
}
|
}
|
||||||
unicode_copy_as_widechar(unicode, buffer, buflen + 1);
|
unicode_copy_as_widechar(unicode, buffer, buflen + 1);
|
||||||
|
|
||||||
#if HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
|
#ifdef HAVE_NON_UNICODE_WCHAR_T_REPRESENTATION
|
||||||
/* Oracle Solaris uses non-Unicode internal wchar_t form for
|
/* Oracle Solaris uses non-Unicode internal wchar_t form for
|
||||||
non-Unicode locales and hence needs conversion first. */
|
non-Unicode locales and hence needs conversion first. */
|
||||||
if (_Py_LocaleUsesNonUnicodeWchar()) {
|
if (_Py_LocaleUsesNonUnicodeWchar()) {
|
||||||
|
|
|
@ -962,7 +962,7 @@ _PyTime_GetSystemClockWithInfo(_PyTime_t *t, _Py_clock_info_t *info)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if __APPLE__
|
#ifdef __APPLE__
|
||||||
static int
|
static int
|
||||||
py_mach_timebase_info(_PyTime_t *pnumer, _PyTime_t *pdenom, int raise)
|
py_mach_timebase_info(_PyTime_t *pnumer, _PyTime_t *pdenom, int raise)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue