Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6e61d18

Browse files
committed
Issue 10052: merge fix from 3.2.
2 parents 9a2b267 + ce31f66 commit 6e61d18

4 files changed

Lines changed: 93 additions & 8 deletions

File tree

Include/pyport.h

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,33 +87,46 @@ Used in: PY_LONG_LONG
8787
* uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.
8888
* However, it doesn't set HAVE_UINT32_T, so we do that here.
8989
*/
90-
#if (defined UINT32_MAX || defined uint32_t)
91-
#ifndef PY_UINT32_T
90+
#ifdef uint32_t
9291
#define HAVE_UINT32_T 1
92+
#endif
93+
94+
#ifdef HAVE_UINT32_T
95+
#ifndef PY_UINT32_T
9396
#define PY_UINT32_T uint32_t
9497
#endif
9598
#endif
9699

97100
/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the
98101
* long integer implementation, when 30-bit digits are enabled.
99102
*/
100-
#if (defined UINT64_MAX || defined uint64_t)
101-
#ifndef PY_UINT64_T
103+
#ifdef uint64_t
102104
#define HAVE_UINT64_T 1
105+
#endif
106+
107+
#ifdef HAVE_UINT64_T
108+
#ifndef PY_UINT64_T
103109
#define PY_UINT64_T uint64_t
104110
#endif
105111
#endif
106112

107113
/* Signed variants of the above */
108-
#if (defined INT32_MAX || defined int32_t)
109-
#ifndef PY_INT32_T
114+
#ifdef int32_t
110115
#define HAVE_INT32_T 1
116+
#endif
117+
118+
#ifdef HAVE_INT32_T
119+
#ifndef PY_INT32_T
111120
#define PY_INT32_T int32_t
112121
#endif
113122
#endif
114-
#if (defined INT64_MAX || defined int64_t)
115-
#ifndef PY_INT64_T
123+
124+
#ifdef int64_t
116125
#define HAVE_INT64_T 1
126+
#endif
127+
128+
#ifdef HAVE_INT64_T
129+
#ifndef PY_INT64_T
117130
#define PY_INT64_T int64_t
118131
#endif
119132
#endif

configure

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7433,6 +7433,21 @@ $as_echo "#define gid_t int" >>confdefs.h
74337433

74347434
fi
74357435

7436+
7437+
# There are two separate checks for each of the exact-width integer types we
7438+
# need. First we check whether the type is available using the usual
7439+
# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
7440+
# and <stdint.h> where available). We then also use the special type checks of
7441+
# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
7442+
# directly, #define's uint32_t to be a suitable type.
7443+
7444+
ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default"
7445+
if test "x$ac_cv_type_uint32_t" = xyes; then :
7446+
7447+
$as_echo "#define HAVE_UINT32_T 1" >>confdefs.h
7448+
7449+
fi
7450+
74367451
ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
74377452
case $ac_cv_c_uint32_t in #(
74387453
no|yes) ;; #(
@@ -7447,6 +7462,14 @@ _ACEOF
74477462
;;
74487463
esac
74497464

7465+
7466+
ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default"
7467+
if test "x$ac_cv_type_uint64_t" = xyes; then :
7468+
7469+
$as_echo "#define HAVE_UINT64_T 1" >>confdefs.h
7470+
7471+
fi
7472+
74507473
ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
74517474
case $ac_cv_c_uint64_t in #(
74527475
no|yes) ;; #(
@@ -7461,6 +7484,14 @@ _ACEOF
74617484
;;
74627485
esac
74637486

7487+
7488+
ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default"
7489+
if test "x$ac_cv_type_int32_t" = xyes; then :
7490+
7491+
$as_echo "#define HAVE_INT32_T 1" >>confdefs.h
7492+
7493+
fi
7494+
74647495
ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t"
74657496
case $ac_cv_c_int32_t in #(
74667497
no|yes) ;; #(
@@ -7472,6 +7503,14 @@ _ACEOF
74727503
;;
74737504
esac
74747505

7506+
7507+
ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default"
7508+
if test "x$ac_cv_type_int64_t" = xyes; then :
7509+
7510+
$as_echo "#define HAVE_INT64_T 1" >>confdefs.h
7511+
7512+
fi
7513+
74757514
ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
74767515
case $ac_cv_c_int64_t in #(
74777516
no|yes) ;; #(
@@ -7483,6 +7522,7 @@ _ACEOF
74837522
;;
74847523
esac
74857524

7525+
74867526
ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
74877527
if test "x$ac_cv_type_ssize_t" = xyes; then :
74887528

configure.ac

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,10 +1638,30 @@ AC_TYPE_PID_T
16381638
AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is always void])
16391639
AC_TYPE_SIZE_T
16401640
AC_TYPE_UID_T
1641+
1642+
# There are two separate checks for each of the exact-width integer types we
1643+
# need. First we check whether the type is available using the usual
1644+
# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
1645+
# and <stdint.h> where available). We then also use the special type checks of
1646+
# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
1647+
# directly, #define's uint32_t to be a suitable type.
1648+
1649+
AC_CHECK_TYPE(uint32_t,
1650+
AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
16411651
AC_TYPE_UINT32_T
1652+
1653+
AC_CHECK_TYPE(uint64_t,
1654+
AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
16421655
AC_TYPE_UINT64_T
1656+
1657+
AC_CHECK_TYPE(int32_t,
1658+
AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
16431659
AC_TYPE_INT32_T
1660+
1661+
AC_CHECK_TYPE(int64_t,
1662+
AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
16441663
AC_TYPE_INT64_T
1664+
16451665
AC_CHECK_TYPE(ssize_t,
16461666
AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
16471667
AC_CHECK_TYPE(__uint128_t,

pyconfig.h.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,12 @@
426426
/* Define to 1 if you have the `initgroups' function. */
427427
#undef HAVE_INITGROUPS
428428

429+
/* Define if your compiler provides int32_t. */
430+
#undef HAVE_INT32_T
431+
432+
/* Define if your compiler provides int64_t. */
433+
#undef HAVE_INT64_T
434+
429435
/* Define to 1 if you have the <inttypes.h> header file. */
430436
#undef HAVE_INTTYPES_H
431437

@@ -1047,6 +1053,12 @@
10471053
/* Define this if you have tcl and TCL_UTF_MAX==6 */
10481054
#undef HAVE_UCS4_TCL
10491055

1056+
/* Define if your compiler provides uint32_t. */
1057+
#undef HAVE_UINT32_T
1058+
1059+
/* Define if your compiler provides uint64_t. */
1060+
#undef HAVE_UINT64_T
1061+
10501062
/* Define to 1 if the system has the type `uintptr_t'. */
10511063
#undef HAVE_UINTPTR_T
10521064

0 commit comments

Comments
 (0)