Skip to content

Commit 8a75b3c

Browse files
authored
Remove conditional checks for ssize_t type (#18996)
The ssize_t type is already used unconditionally in php-src code everywhere except the main/s{n,p}printf.c files. On Windows ssize_t is available as an alias to the SSIZE_T defined in BaseTsd.h (available in affected files through the included windows.h in zend_config.w32.h). This also makes the Autoconf macro PHP_CHECK_SIZEOF obsolete in favor of the AC_CHECK_SIZEOF, which is more convenient to check for types without the need to run the test program - omitting the cross-compilation issues. AC_CHECK_SIZEOF once didn't provide including additional headers (resolved in Autoconf versions after 2.13).
1 parent 45c4650 commit 8a75b3c

File tree

5 files changed

+9
-12
lines changed

5 files changed

+9
-12
lines changed

‎UPGRADING.INTERNALS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,14 @@ PHP 8.5 INTERNALS UPGRADE NOTES
7272
. Autoconf macro PHP_AP_EXTRACT_VERSION has been removed.
7373
. Autoconf macro PHP_BUILD_THREAD_SAFE has been removed (set enable_zts
7474
manually).
75+
. Autoconf macro PHP_CHECK_SIZEOF is obsolete (use AC_CHECK_SIZEOF).
7576
. Autoconf macro PHP_DEF_HAVE has been removed (use AC_DEFINE).
7677
. Autoconf macro PHP_OUTPUT has been removed (use AC_CONFIG_FILES).
7778
. Autoconf macro PHP_TEST_BUILD has been removed (use AC_* macros).
7879
. Preprocessor macro HAVE_PTRDIFF_T has been removed.
7980
. Preprocessor macro HAVE_INTMAX_T has been removed.
81+
. Preprocessor macro HAVE_SSIZE_T has been removed.
82+
. Preprocessor macro SIZEOF_SSIZE_T has been removed.
8083

8184
========================
8285
3. Module changes

‎build/php.m4

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,9 @@ dnl _PHP_CHECK_SIZEOF(type, cross-value, extra-headers [, found-action [, not-fo
10141014
dnl
10151015
dnl Internal helper macro.
10161016
dnl
1017-
AC_DEFUN([_PHP_CHECK_SIZEOF], [
1017+
AC_DEFUN([_PHP_CHECK_SIZEOF],
1018+
[m4_warn([obsolete],
1019+
[The PHP_CHECK_SIZEOF macro is obsolete. Use AC_CHECK_SIZEOF.])
10181020
php_cache_value=php_cv_sizeof_[]$1
10191021
AC_CACHE_VAL(php_cv_sizeof_[]$1, [
10201022
old_LIBS=$LIBS
@@ -1056,6 +1058,9 @@ ifelse([$5],[],,[else $5])
10561058
dnl
10571059
dnl PHP_CHECK_SIZEOF(type, cross-value, extra-headers)
10581060
dnl
1061+
dnl Checks the size of specified "type". This macro is obsolete as of PHP 8.5 in
1062+
dnl favor of the AC_CHECK_SIZEOF.
1063+
dnl
10591064
AC_DEFUN([PHP_CHECK_SIZEOF], [
10601065
AC_MSG_CHECKING([size of $1])
10611066
_PHP_CHECK_SIZEOF($1, $2, $3, [

‎configure.ac

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,6 @@ AC_CHECK_TYPES([socklen_t], [], [], [
451451
#endif
452452
])
453453

454-
dnl These are defined elsewhere than stdio.h.
455-
PHP_CHECK_SIZEOF([ssize_t], [8])
456-
457454
dnl Check stdint types (must be after header check).
458455
PHP_CHECK_STDINT_TYPES
459456

‎main/snprintf.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -709,11 +709,7 @@ static size_t format_converter(buffy * odp, const char *fmt, va_list ap) /* {{{
709709
i_num = (int64_t) va_arg(ap, long int);
710710
break;
711711
case LM_SIZE_T:
712-
#if SIZEOF_SSIZE_T
713712
i_num = (int64_t) va_arg(ap, ssize_t);
714-
#else
715-
i_num = (int64_t) va_arg(ap, size_t);
716-
#endif
717713
break;
718714
#if SIZEOF_LONG_LONG
719715
case LM_LONG_LONG:

‎main/spprintf.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,7 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
418418
i_num = (int64_t) va_arg(ap, long int);
419419
break;
420420
case LM_SIZE_T:
421-
#if SIZEOF_SSIZE_T
422421
i_num = (int64_t) va_arg(ap, ssize_t);
423-
#else
424-
i_num = (int64_t) va_arg(ap, size_t);
425-
#endif
426422
break;
427423
#if SIZEOF_LONG_LONG
428424
case LM_LONG_LONG:

0 commit comments

Comments
 (0)