Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
4fe55106
Commit
4fe55106
authored
Sep 06, 2016
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
require standard int types to be defined (#17884)
parent
39093e9e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
401 deletions
+15
-401
Include/longintrepr.h
Include/longintrepr.h
+0
-4
Include/pyport.h
Include/pyport.h
+1
-51
Misc/NEWS
Misc/NEWS
+2
-0
Modules/_testcapimodule.c
Modules/_testcapimodule.c
+0
-8
PC/pyconfig.h
PC/pyconfig.h
+4
-33
Python/dtoa.c
Python/dtoa.c
+3
-12
configure
configure
+2
-225
configure.ac
configure.ac
+3
-30
pyconfig.h.in
pyconfig.h.in
+0
-38
No files found.
Include/longintrepr.h
View file @
4fe55106
...
...
@@ -42,10 +42,6 @@ extern "C" {
*/
#if PYLONG_BITS_IN_DIGIT == 30
#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \
defined HAVE_INT64_T && defined HAVE_INT32_T)
#error "30-bit long digits requested, but the necessary types are not available on this platform"
#endif
typedef
PY_UINT32_T
digit
;
typedef
PY_INT32_T
sdigit
;
/* signed variant of digit */
typedef
PY_UINT64_T
twodigits
;
...
...
Include/pyport.h
View file @
4fe55106
...
...
@@ -5,13 +5,8 @@
/* Some versions of HP-UX & Solaris need inttypes.h for int32_t,
INT32_MAX, etc. */
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
/**************************************************************************
Symbols and macros to supply platform-independent interfaces to basic
...
...
@@ -74,64 +69,19 @@ Used in: Py_uintptr_t
#endif
/* LLONG_MAX */
#endif
/* a build with 30-bit digits for Python integers needs an exact-width
* 32-bit unsigned integer type to store those digits. (We could just use
* type 'unsigned long', but that would be wasteful on a system where longs
* are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines
* uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t.
* However, it doesn't set HAVE_UINT32_T, so we do that here.
*/
#ifdef uint32_t
#define HAVE_UINT32_T 1
#endif
#ifdef HAVE_UINT32_T
#ifndef PY_UINT32_T
#define PY_UINT32_T uint32_t
#endif
#endif
/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the
* integer implementation, when 30-bit digits are enabled.
*/
#ifdef uint64_t
#define HAVE_UINT64_T 1
#endif
#ifdef HAVE_UINT64_T
#ifndef PY_UINT64_T
#define PY_UINT64_T uint64_t
#endif
#endif
/* Signed variants of the above */
#ifdef int32_t
#define HAVE_INT32_T 1
#endif
#ifdef HAVE_INT32_T
#ifndef PY_INT32_T
#define PY_INT32_T int32_t
#endif
#endif
#ifdef int64_t
#define HAVE_INT64_T 1
#endif
#ifdef HAVE_INT64_T
#ifndef PY_INT64_T
#define PY_INT64_T int64_t
#endif
#endif
/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all
the necessary integer types are available, and we're on a 64-bit platform
(as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */
#ifndef PYLONG_BITS_IN_DIGIT
#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \
defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8)
#if SIZEOF_VOID_P >= 8
#define PYLONG_BITS_IN_DIGIT 30
#else
#define PYLONG_BITS_IN_DIGIT 15
...
...
Misc/NEWS
View file @
4fe55106
...
...
@@ -10,6 +10,8 @@ What's New in Python 3.6.0 beta 1
Core and Builtins
-----------------
- Issue #17884: Python now requires systems with inttypes.h and stdint.h
- Issue #27961?: Require platforms to support ``long long``. Python hasn'
t
compiled
without
``
long
long
``
for
years
,
so
this
is
basically
a
formality
.
...
...
Modules/_testcapimodule.c
View file @
4fe55106
...
...
@@ -98,22 +98,14 @@ test_sizeof_c_types(PyObject *self)
CHECK_SIGNNESS
(
Py_UCS1
,
0
);
CHECK_SIGNNESS
(
Py_UCS2
,
0
);
CHECK_SIGNNESS
(
Py_UCS4
,
0
);
#ifdef HAVE_INT32_T
CHECK_SIZEOF
(
PY_INT32_T
,
4
);
CHECK_SIGNNESS
(
PY_INT32_T
,
1
);
#endif
#ifdef HAVE_UINT32_T
CHECK_SIZEOF
(
PY_UINT32_T
,
4
);
CHECK_SIGNNESS
(
PY_UINT32_T
,
0
);
#endif
#ifdef HAVE_INT64_T
CHECK_SIZEOF
(
PY_INT64_T
,
8
);
CHECK_SIGNNESS
(
PY_INT64_T
,
1
);
#endif
#ifdef HAVE_UINT64_T
CHECK_SIZEOF
(
PY_UINT64_T
,
8
);
CHECK_SIGNNESS
(
PY_UINT64_T
,
0
);
#endif
/* pointer/size types */
CHECK_SIZEOF
(
size_t
,
sizeof
(
void
*
));
...
...
PC/pyconfig.h
View file @
4fe55106
...
...
@@ -365,39 +365,10 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
/* define signed and unsigned exact-width 32-bit and 64-bit types, used in the
implementation of Python integers. */
#ifndef PY_UINT32_T
#if SIZEOF_INT == 4
#define HAVE_UINT32_T 1
#define PY_UINT32_T unsigned int
#elif SIZEOF_LONG == 4
#define HAVE_UINT32_T 1
#define PY_UINT32_T unsigned long
#endif
#endif
#ifndef PY_UINT64_T
#if SIZEOF_LONG_LONG == 8
#define HAVE_UINT64_T 1
#define PY_UINT64_T unsigned long long
#endif
#endif
#ifndef PY_INT32_T
#if SIZEOF_INT == 4
#define HAVE_INT32_T 1
#define PY_INT32_T int
#elif SIZEOF_LONG == 4
#define HAVE_INT32_T 1
#define PY_INT32_T long
#endif
#endif
#ifndef PY_INT64_T
#if SIZEOF_LONG_LONG == 8
#define HAVE_INT64_T 1
#define PY_INT64_T long long
#endif
#endif
#define PY_UINT32_T uint32_t
#define PY_UINT64_T uint64_t
#define PY_INT32_T int32_t
#define PY_INT64_T int64_t
/* Fairly standard from here! */
...
...
Python/dtoa.c
View file @
4fe55106
...
...
@@ -151,18 +151,9 @@
#endif
#if defined(HAVE_UINT32_T) && defined(HAVE_INT32_T)
typedef
PY_UINT32_T
ULong
;
typedef
PY_INT32_T
Long
;
#else
#error "Failed to find an exact-width 32-bit integer type"
#endif
#if defined(HAVE_UINT64_T)
#define ULLong PY_UINT64_T
#else
#undef ULLong
#endif
typedef
uint32_t
ULong
;
typedef
int32_t
Long
;
typedef
uint64_t
ULLong
;
#undef DEBUG
#ifdef Py_DEBUG
...
...
configure
View file @
4fe55106
...
...
@@ -1974,136 +1974,6 @@ $as_echo "$ac_res" >&6; }
}
# ac_fn_c_check_type
# ac_fn_c_find_uintX_t LINENO BITS VAR
# ------------------------------------
# Finds an unsigned integer type with width BITS, setting cache variable VAR
# accordingly.
ac_fn_c_find_uintX_t
()
{
as_lineno
=
${
as_lineno
-
"
$1
"
}
as_lineno_stack
=
as_lineno_stack
=
$as_lineno_stack
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for uint
$2_t
"
>
&5
$as_echo_n
"checking for uint
$2_t
... "
>
&6
;
}
if
eval
\$
{
$3
+:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
eval
"
$3
=no"
# Order is important - never check a type that is potentially smaller
# than half of the expected target width.
for
ac_type
in
uint
$2_t
'unsigned int'
'unsigned long int'
\
'unsigned long long int'
'unsigned short int'
'unsigned char'
;
do
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
static int test_array [1 - 2 * !(((
$ac_type
) -1 >> (
$2
/ 2 - 1)) >> (
$2
/ 2 - 1) == 3)];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if
ac_fn_c_try_compile
"
$LINENO
"
;
then
:
case
$ac_type
in
#(
uint
$2_t
)
:
eval
"
$3
=yes"
;;
#(
*
)
:
eval
"
$3
=
\$
ac_type"
;;
esac
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
if
eval test
\"
x
\$
"
$3
"
\"
=
x
"no"
;
then
:
else
break
fi
done
fi
eval
ac_res
=
\$
$3
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_res
"
>
&5
$as_echo
"
$ac_res
"
>
&6
;
}
eval
$as_lineno_stack
;
${
as_lineno_stack
:+:
}
unset
as_lineno
}
# ac_fn_c_find_uintX_t
# ac_fn_c_find_intX_t LINENO BITS VAR
# -----------------------------------
# Finds a signed integer type with width BITS, setting cache variable VAR
# accordingly.
ac_fn_c_find_intX_t
()
{
as_lineno
=
${
as_lineno
-
"
$1
"
}
as_lineno_stack
=
as_lineno_stack
=
$as_lineno_stack
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: checking for int
$2_t
"
>
&5
$as_echo_n
"checking for int
$2_t
... "
>
&6
;
}
if
eval
\$
{
$3
+:
}
false
;
then
:
$as_echo_n
"(cached) "
>
&6
else
eval
"
$3
=no"
# Order is important - never check a type that is potentially smaller
# than half of the expected target width.
for
ac_type
in
int
$2_t
'int'
'long int'
\
'long long int'
'short int'
'signed char'
;
do
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
$ac_includes_default
enum { N =
$2
/ 2 - 1 };
int
main ()
{
static int test_array [1 - 2 * !(0 < (
$ac_type
) (((((
$ac_type
) 1 << N) << N) - 1) * 2 + 1))];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if
ac_fn_c_try_compile
"
$LINENO
"
;
then
:
cat
confdefs.h -
<<
_ACEOF
>conftest.
$ac_ext
/* end confdefs.h. */
$ac_includes_default
enum { N =
$2
/ 2 - 1 };
int
main ()
{
static int test_array [1 - 2 * !((
$ac_type
) (((((
$ac_type
) 1 << N) << N) - 1) * 2 + 1)
< (
$ac_type
) (((((
$ac_type
) 1 << N) << N) - 1) * 2 + 2))];
test_array [0] = 0;
return test_array [0];
;
return 0;
}
_ACEOF
if
ac_fn_c_try_compile
"
$LINENO
"
;
then
:
else
case
$ac_type
in
#(
int
$2_t
)
:
eval
"
$3
=yes"
;;
#(
*
)
:
eval
"
$3
=
\$
ac_type"
;;
esac
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
if
eval test
\"
x
\$
"
$3
"
\"
=
x
"no"
;
then
:
else
break
fi
done
fi
eval
ac_res
=
\$
$3
{
$as_echo
"
$as_me
:
${
as_lineno
-
$LINENO
}
: result:
$ac_res
"
>
&5
$as_echo
"
$ac_res
"
>
&6
;
}
eval
$as_lineno_stack
;
${
as_lineno_stack
:+:
}
unset
as_lineno
}
# ac_fn_c_find_intX_t
# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
# --------------------------------------------
# Tries to find the compile-time value of EXPR in a program that includes
...
...
@@ -7582,7 +7452,7 @@ fi
for
ac_header
in
asm/types.h conio.h direct.h dlfcn.h errno.h
\
fcntl.h grp.h
\
ieeefp.h io.h langinfo.h libintl.h process.h pthread.h
\
sched.h shadow.h signal.h st
dint.h st
ropts.h termios.h
\
sched.h shadow.h signal.h stropts.h termios.h
\
unistd.h utime.h
\
poll.h sys/devpoll.h sys/epoll.h sys/poll.h
\
sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h
\
...
...
@@ -8130,95 +8000,6 @@ $as_echo "#define gid_t int" >>confdefs.h
fi
# There are two separate checks for each of the exact-width integer types we
# need. First we check whether the type is available using the usual
# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
# and <stdint.h> where available). We then also use the special type checks of
# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
# directly, #define's uint32_t to be a suitable type.
ac_fn_c_check_type
"
$LINENO
"
"uint32_t"
"ac_cv_type_uint32_t"
"
$ac_includes_default
"
if
test
"x
$ac_cv_type_uint32_t
"
=
xyes
;
then
:
$as_echo
"#define HAVE_UINT32_T 1"
>>
confdefs.h
fi
ac_fn_c_find_uintX_t
"
$LINENO
"
"32"
"ac_cv_c_uint32_t"
case
$ac_cv_c_uint32_t
in
#(
no|yes
)
;;
#(
*
)
$as_echo
"#define _UINT32_T 1"
>>
confdefs.h
cat
>>
confdefs.h
<<
_ACEOF
#define uint32_t
$ac_cv_c_uint32_t
_ACEOF
;;
esac
ac_fn_c_check_type
"
$LINENO
"
"uint64_t"
"ac_cv_type_uint64_t"
"
$ac_includes_default
"
if
test
"x
$ac_cv_type_uint64_t
"
=
xyes
;
then
:
$as_echo
"#define HAVE_UINT64_T 1"
>>
confdefs.h
fi
ac_fn_c_find_uintX_t
"
$LINENO
"
"64"
"ac_cv_c_uint64_t"
case
$ac_cv_c_uint64_t
in
#(
no|yes
)
;;
#(
*
)
$as_echo
"#define _UINT64_T 1"
>>
confdefs.h
cat
>>
confdefs.h
<<
_ACEOF
#define uint64_t
$ac_cv_c_uint64_t
_ACEOF
;;
esac
ac_fn_c_check_type
"
$LINENO
"
"int32_t"
"ac_cv_type_int32_t"
"
$ac_includes_default
"
if
test
"x
$ac_cv_type_int32_t
"
=
xyes
;
then
:
$as_echo
"#define HAVE_INT32_T 1"
>>
confdefs.h
fi
ac_fn_c_find_intX_t
"
$LINENO
"
"32"
"ac_cv_c_int32_t"
case
$ac_cv_c_int32_t
in
#(
no|yes
)
;;
#(
*
)
cat
>>
confdefs.h
<<
_ACEOF
#define int32_t
$ac_cv_c_int32_t
_ACEOF
;;
esac
ac_fn_c_check_type
"
$LINENO
"
"int64_t"
"ac_cv_type_int64_t"
"
$ac_includes_default
"
if
test
"x
$ac_cv_type_int64_t
"
=
xyes
;
then
:
$as_echo
"#define HAVE_INT64_T 1"
>>
confdefs.h
fi
ac_fn_c_find_intX_t
"
$LINENO
"
"64"
"ac_cv_c_int64_t"
case
$ac_cv_c_int64_t
in
#(
no|yes
)
;;
#(
*
)
cat
>>
confdefs.h
<<
_ACEOF
#define int64_t
$ac_cv_c_int64_t
_ACEOF
;;
esac
ac_fn_c_check_type
"
$LINENO
"
"ssize_t"
"ac_cv_type_ssize_t"
"
$ac_includes_default
"
if
test
"x
$ac_cv_type_ssize_t
"
=
xyes
;
then
:
...
...
@@ -8690,12 +8471,8 @@ _ACEOF
fi
ac_fn_c_check_type
"
$LINENO
"
"uintptr_t"
"ac_cv_type_uintptr_t"
"#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
ac_fn_c_check_type
"
$LINENO
"
"uintptr_t"
"ac_cv_type_uintptr_t"
"#include <stdint.h>
#include <inttypes.h>
#endif
"
if
test
"x
$ac_cv_type_uintptr_t
"
=
xyes
;
then
:
...
...
configure.ac
View file @
4fe55106
...
...
@@ -1918,7 +1918,7 @@ AC_HEADER_STDC
AC_CHECK_HEADERS(asm/types.h conio.h direct.h dlfcn.h errno.h \
fcntl.h grp.h \
ieeefp.h io.h langinfo.h libintl.h process.h pthread.h \
sched.h shadow.h signal.h st
dint.h st
ropts.h termios.h \
sched.h shadow.h signal.h stropts.h termios.h \
unistd.h utime.h \
poll.h sys/devpoll.h sys/epoll.h sys/poll.h \
sys/audioio.h sys/xattr.h sys/bsdtty.h sys/event.h sys/file.h sys/ioctl.h \
...
...
@@ -2060,29 +2060,6 @@ AC_DEFINE_UNQUOTED([RETSIGTYPE],[void],[assume C89 semantics that RETSIGTYPE is
AC_TYPE_SIZE_T
AC_TYPE_UID_T
# There are two separate checks for each of the exact-width integer types we
# need. First we check whether the type is available using the usual
# AC_CHECK_TYPE macro with the default includes (which includes <inttypes.h>
# and <stdint.h> where available). We then also use the special type checks of
# the form AC_TYPE_UINT32_T, which in the case that uint32_t is not available
# directly, #define's uint32_t to be a suitable type.
AC_CHECK_TYPE(uint32_t,
AC_DEFINE(HAVE_UINT32_T, 1, [Define if your compiler provides uint32_t.]),,)
AC_TYPE_UINT32_T
AC_CHECK_TYPE(uint64_t,
AC_DEFINE(HAVE_UINT64_T, 1, [Define if your compiler provides uint64_t.]),,)
AC_TYPE_UINT64_T
AC_CHECK_TYPE(int32_t,
AC_DEFINE(HAVE_INT32_T, 1, [Define if your compiler provides int32_t.]),,)
AC_TYPE_INT32_T
AC_CHECK_TYPE(int64_t,
AC_DEFINE(HAVE_INT64_T, 1, [Define if your compiler provides int64_t.]),,)
AC_TYPE_INT64_T
AC_CHECK_TYPE(ssize_t,
AC_DEFINE(HAVE_SSIZE_T, 1, [Define if your compiler provides ssize_t]),,)
AC_CHECK_TYPE(__uint128_t,
...
...
@@ -2126,12 +2103,8 @@ fi
AC_CHECK_TYPES(uintptr_t,
[AC_CHECK_SIZEOF(uintptr_t, 4)],
[], [#ifdef HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif])
[], [#include <stdint.h>
#include <inttypes.h>])
AC_CHECK_SIZEOF(off_t, [], [
#ifdef HAVE_SYS_TYPES_H
...
...
pyconfig.h.in
View file @
4fe55106
...
...
@@ -484,12 +484,6 @@
/* Define to 1 if you have the `initgroups' function. */
#undef HAVE_INITGROUPS
/* Define if your compiler provides int32_t. */
#undef HAVE_INT32_T
/* Define if your compiler provides int64_t. */
#undef HAVE_INT64_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
...
...
@@ -1140,12 +1134,6 @@
/* Define this if you have tcl and TCL_UTF_MAX==6 */
#undef HAVE_UCS4_TCL
/* Define if your compiler provides uint32_t. */
#undef HAVE_UINT32_T
/* Define if your compiler provides uint64_t. */
#undef HAVE_UINT64_T
/* Define to 1 if the system has the type `uintptr_t'. */
#undef HAVE_UINTPTR_T
...
...
@@ -1479,16 +1467,6 @@
/* Define to force use of thread-safe errno, h_errno, and other functions */
#undef _REENTRANT
/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT32_T
/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
<pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
#define below would cause a syntax error. */
#undef _UINT64_T
/* Define to the level of X/Open that your system supports */
#undef _XOPEN_SOURCE
...
...
@@ -1518,14 +1496,6 @@
#undef inline
#endif
/* Define to the type of a signed integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef int32_t
/* Define to the type of a signed integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef int64_t
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
...
...
@@ -1547,14 +1517,6 @@
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define to the type of an unsigned integer type of width exactly 32 bits if
such a type exists and the standard includes do not define it. */
#undef uint32_t
/* Define to the type of an unsigned integer type of width exactly 64 bits if
such a type exists and the standard includes do not define it. */
#undef uint64_t
/* Define to empty if the keyword does not work. */
#undef volatile
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment