Browse Source

Remove HAVE_INTMAX_T and SIZEOF_INTMAX_T (#18971)

The intmax_t is a C99 standard type defined in `<stdint.h>` and widely
available on current platforms. On Windows they are available as of
Visual Studio 2013. Using it conditionally as in these occurrences is
not needed anymore.
pull/18981/head
Peter Kokot 4 months ago
committed by GitHub
parent
commit
93e3aca5fa
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      UPGRADING.INTERNALS
  2. 1
      configure.ac
  3. 12
      main/snprintf.c
  4. 2
      main/snprintf.h
  5. 12
      main/spprintf.c
  6. 3
      win32/build/config.w32.h.in

2
UPGRADING.INTERNALS

@ -52,6 +52,7 @@ PHP 8.5 INTERNALS UPGRADE NOTES
- Abstract
. Preprocessor macro SIZEOF_PTRDIFF_T has been removed.
. Preprocessor macro SIZEOF_INTMAX_T has been removed.
- Windows build system changes
. SAPI() and ADD_SOURCES() now suport the optional `duplicate_sources`
@ -73,6 +74,7 @@ PHP 8.5 INTERNALS UPGRADE NOTES
. Autoconf macro PHP_OUTPUT has been removed (use AC_CONFIG_FILES).
. Autoconf macro PHP_TEST_BUILD has been removed (use AC_* macros).
. Preprocessor macro HAVE_PTRDIFF_T has been removed.
. Preprocessor macro HAVE_INTMAX_T has been removed.
========================
3. Module changes

1
configure.ac

@ -452,7 +452,6 @@ AC_CHECK_TYPES([socklen_t], [], [], [
])
dnl These are defined elsewhere than stdio.h.
PHP_CHECK_SIZEOF([intmax_t], [0])
PHP_CHECK_SIZEOF([ssize_t], [8])
dnl Check stdint types (must be after header check).

12
main/snprintf.c

@ -613,11 +613,7 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
break;
case 'j':
fmt++;
#if SIZEOF_INTMAX_T
modifier = LM_INTMAX_T;
#else
modifier = LM_SIZE_T;
#endif
break;
case 't':
fmt++;
@ -685,11 +681,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
i_num = (int64_t) va_arg(ap, unsigned long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
i_num = (int64_t) va_arg(ap, uintmax_t);
break;
#endif
case LM_PTRDIFF_T:
i_num = (int64_t) va_arg(ap, ptrdiff_t);
break;
@ -726,11 +720,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
i_num = (int64_t) va_arg(ap, long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
i_num = (int64_t) va_arg(ap, intmax_t);
break;
#endif
case LM_PTRDIFF_T:
i_num = (int64_t) va_arg(ap, ptrdiff_t);
break;
@ -770,11 +762,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
ui_num = (uint64_t) va_arg(ap, uintmax_t);
break;
#endif
case LM_PTRDIFF_T:
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
break;
@ -807,11 +797,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
ui_num = (uint64_t) va_arg(ap, uintmax_t);
break;
#endif
case LM_PTRDIFF_T:
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
break;

2
main/snprintf.h

@ -113,9 +113,7 @@ END_EXTERN_C()
typedef enum {
LM_STD = 0,
#if SIZEOF_INTMAX_T
LM_INTMAX_T,
#endif
LM_PTRDIFF_T,
#if SIZEOF_LONG_LONG
LM_LONG_LONG,

12
main/spprintf.c

@ -313,11 +313,7 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
break;
case 'j':
fmt++;
#if SIZEOF_INTMAX_T
modifier = LM_INTMAX_T;
#else
modifier = LM_SIZE_T;
#endif
break;
case 't':
fmt++;
@ -394,11 +390,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
i_num = (int64_t) va_arg(ap, unsigned long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
i_num = (int64_t) va_arg(ap, uintmax_t);
break;
#endif
case LM_PTRDIFF_T:
i_num = (int64_t) va_arg(ap, ptrdiff_t);
break;
@ -435,11 +429,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
i_num = (int64_t) va_arg(ap, long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
i_num = (int64_t) va_arg(ap, intmax_t);
break;
#endif
case LM_PTRDIFF_T:
i_num = (int64_t) va_arg(ap, ptrdiff_t);
break;
@ -478,11 +470,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
ui_num = (uint64_t) va_arg(ap, uintmax_t);
break;
#endif
case LM_PTRDIFF_T:
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
break;
@ -516,11 +506,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
break;
#endif
#if SIZEOF_INTMAX_T
case LM_INTMAX_T:
ui_num = (uint64_t) va_arg(ap, uintmax_t);
break;
#endif
case LM_PTRDIFF_T:
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
break;

3
win32/build/config.w32.h.in

@ -78,9 +78,8 @@
/* int and long are still 32bit in 64bit compiles */
#define SIZEOF_INT 4
#define SIZEOF_LONG 4
/* MSVC.6/NET don't allow 'long long' or know 'intmax_t' */
/* MSVC.6/NET don't allow 'long long' */
#define SIZEOF_LONG_LONG 8 /* defined as __int64 */
#define SIZEOF_INTMAX_T 0
#define ssize_t SSIZE_T
#ifdef _WIN64
# define SIZEOF_SIZE_T 8

Loading…
Cancel
Save