Skip to content

Commit 93e3aca

Browse files
authored
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.
1 parent 9644ba6 commit 93e3aca

File tree

6 files changed

+3
-29
lines changed

6 files changed

+3
-29
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ PHP 8.5 INTERNALS UPGRADE NOTES
5252

5353
- Abstract
5454
. Preprocessor macro SIZEOF_PTRDIFF_T has been removed.
55+
. Preprocessor macro SIZEOF_INTMAX_T has been removed.
5556

5657
- Windows build system changes
5758
. SAPI() and ADD_SOURCES() now suport the optional `duplicate_sources`
@@ -73,6 +74,7 @@ PHP 8.5 INTERNALS UPGRADE NOTES
7374
. Autoconf macro PHP_OUTPUT has been removed (use AC_CONFIG_FILES).
7475
. Autoconf macro PHP_TEST_BUILD has been removed (use AC_* macros).
7576
. Preprocessor macro HAVE_PTRDIFF_T has been removed.
77+
. Preprocessor macro HAVE_INTMAX_T has been removed.
7678

7779
========================
7880
3. Module changes

configure.ac

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ AC_CHECK_TYPES([socklen_t], [], [], [
452452
])
453453

454454
dnl These are defined elsewhere than stdio.h.
455-
PHP_CHECK_SIZEOF([intmax_t], [0])
456455
PHP_CHECK_SIZEOF([ssize_t], [8])
457456

458457
dnl Check stdint types (must be after header check).

main/snprintf.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,7 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
613613
break;
614614
case 'j':
615615
fmt++;
616-
#if SIZEOF_INTMAX_T
617616
modifier = LM_INTMAX_T;
618-
#else
619-
modifier = LM_SIZE_T;
620-
#endif
621617
break;
622618
case 't':
623619
fmt++;
@@ -685,11 +681,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
685681
i_num = (int64_t) va_arg(ap, unsigned long long int);
686682
break;
687683
#endif
688-
#if SIZEOF_INTMAX_T
689684
case LM_INTMAX_T:
690685
i_num = (int64_t) va_arg(ap, uintmax_t);
691686
break;
692-
#endif
693687
case LM_PTRDIFF_T:
694688
i_num = (int64_t) va_arg(ap, ptrdiff_t);
695689
break;
@@ -726,11 +720,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
726720
i_num = (int64_t) va_arg(ap, long long int);
727721
break;
728722
#endif
729-
#if SIZEOF_INTMAX_T
730723
case LM_INTMAX_T:
731724
i_num = (int64_t) va_arg(ap, intmax_t);
732725
break;
733-
#endif
734726
case LM_PTRDIFF_T:
735727
i_num = (int64_t) va_arg(ap, ptrdiff_t);
736728
break;
@@ -770,11 +762,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
770762
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
771763
break;
772764
#endif
773-
#if SIZEOF_INTMAX_T
774765
case LM_INTMAX_T:
775766
ui_num = (uint64_t) va_arg(ap, uintmax_t);
776767
break;
777-
#endif
778768
case LM_PTRDIFF_T:
779769
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
780770
break;
@@ -807,11 +797,9 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
807797
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
808798
break;
809799
#endif
810-
#if SIZEOF_INTMAX_T
811800
case LM_INTMAX_T:
812801
ui_num = (uint64_t) va_arg(ap, uintmax_t);
813802
break;
814-
#endif
815803
case LM_PTRDIFF_T:
816804
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
817805
break;

main/snprintf.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,7 @@ END_EXTERN_C()
113113

114114
typedef enum {
115115
LM_STD = 0,
116-
#if SIZEOF_INTMAX_T
117116
LM_INTMAX_T,
118-
#endif
119117
LM_PTRDIFF_T,
120118
#if SIZEOF_LONG_LONG
121119
LM_LONG_LONG,

main/spprintf.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,7 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
313313
break;
314314
case 'j':
315315
fmt++;
316-
#if SIZEOF_INTMAX_T
317316
modifier = LM_INTMAX_T;
318-
#else
319-
modifier = LM_SIZE_T;
320-
#endif
321317
break;
322318
case 't':
323319
fmt++;
@@ -394,11 +390,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
394390
i_num = (int64_t) va_arg(ap, unsigned long long int);
395391
break;
396392
#endif
397-
#if SIZEOF_INTMAX_T
398393
case LM_INTMAX_T:
399394
i_num = (int64_t) va_arg(ap, uintmax_t);
400395
break;
401-
#endif
402396
case LM_PTRDIFF_T:
403397
i_num = (int64_t) va_arg(ap, ptrdiff_t);
404398
break;
@@ -435,11 +429,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
435429
i_num = (int64_t) va_arg(ap, long long int);
436430
break;
437431
#endif
438-
#if SIZEOF_INTMAX_T
439432
case LM_INTMAX_T:
440433
i_num = (int64_t) va_arg(ap, intmax_t);
441434
break;
442-
#endif
443435
case LM_PTRDIFF_T:
444436
i_num = (int64_t) va_arg(ap, ptrdiff_t);
445437
break;
@@ -478,11 +470,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
478470
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
479471
break;
480472
#endif
481-
#if SIZEOF_INTMAX_T
482473
case LM_INTMAX_T:
483474
ui_num = (uint64_t) va_arg(ap, uintmax_t);
484475
break;
485-
#endif
486476
case LM_PTRDIFF_T:
487477
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
488478
break;
@@ -516,11 +506,9 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
516506
ui_num = (uint64_t) va_arg(ap, unsigned long long int);
517507
break;
518508
#endif
519-
#if SIZEOF_INTMAX_T
520509
case LM_INTMAX_T:
521510
ui_num = (uint64_t) va_arg(ap, uintmax_t);
522511
break;
523-
#endif
524512
case LM_PTRDIFF_T:
525513
ui_num = (uint64_t) va_arg(ap, ptrdiff_t);
526514
break;

win32/build/config.w32.h.in

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,8 @@
7878
/* int and long are still 32bit in 64bit compiles */
7979
#define SIZEOF_INT 4
8080
#define SIZEOF_LONG 4
81-
/* MSVC.6/NET don't allow 'long long' or know 'intmax_t' */
81+
/* MSVC.6/NET don't allow 'long long' */
8282
#define SIZEOF_LONG_LONG 8 /* defined as __int64 */
83-
#define SIZEOF_INTMAX_T 0
8483
#define ssize_t SSIZE_T
8584
#ifdef _WIN64
8685
# define SIZEOF_SIZE_T 8

0 commit comments

Comments
 (0)