Skip to content

Remove HAVE_INTMAX_T and SIZEOF_INTMAX_T #18971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
12 changes: 0 additions & 12 deletions main/snprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions main/snprintf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 0 additions & 12 deletions main/spprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 1 addition & 2 deletions win32/build/config.w32.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading