From 1a35064a7b487e6564e002e0dad7f9d3e61d7d8b Mon Sep 17 00:00:00 2001 From: TAKAI Kousuke <62541129+t-a-k@users.noreply.github.com> Date: Fri, 29 Aug 2025 01:48:30 +0900 Subject: [PATCH] Introduce I_STDCKDINT config macro This macro is defined in config.h if is available, and used in previously commited code (0f2b1e648156555a96ed54170e1b385a60010910, GH #23503). --- Configure | 6 ++++++ Cross/config.sh-arm-linux | 1 + Cross/config.sh-arm-linux-n770 | 1 + Porting/Glossary | 5 +++++ Porting/config.sh | 1 + config_h.SH | 6 ++++++ configure.com | 7 +++++++ inline.h | 10 ++++------ plan9/config_sh.sample | 1 + pod/perldelta.pod | 4 ++++ win32/config.gc | 1 + win32/config.vc | 1 + win32/config_H.gc | 6 ++++++ win32/config_H.vc | 6 ++++++ 14 files changed, 50 insertions(+), 6 deletions(-) diff --git a/Configure b/Configure index 1bdc687da191..f22b01934690 100755 --- a/Configure +++ b/Configure @@ -1052,6 +1052,7 @@ i_quadmath='' i_shadow='' i_socks='' i_stdbool='' +i_stdckdint='' i_stdint='' i_stdlib='' i_sunmath='' @@ -24226,6 +24227,10 @@ $rm_try set i_stdbool eval $setvar +: see if C23 stdckdint is available +set stdckdint.h i_stdckdint +eval $inhdr + : see if stdint is available set stdint.h i_stdint eval $inhdr @@ -25636,6 +25641,7 @@ i_sgtty='$i_sgtty' i_shadow='$i_shadow' i_socks='$i_socks' i_stdbool='$i_stdbool' +i_stdckdint='$i_stdckdint' i_stdint='$i_stdint' i_stdlib='$i_stdlib' i_sunmath='$i_sunmath' diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux index 4879ee8ad448..9e4750eccb5e 100644 --- a/Cross/config.sh-arm-linux +++ b/Cross/config.sh-arm-linux @@ -791,6 +791,7 @@ i_sgtty='undef' i_shadow='define' i_socks='undef' i_stdbool='undef' +i_stdckdint='undef' i_stdint='define' i_stdlib='define' i_sunmath='undef' diff --git a/Cross/config.sh-arm-linux-n770 b/Cross/config.sh-arm-linux-n770 index 86636c094152..7f73a98953b7 100644 --- a/Cross/config.sh-arm-linux-n770 +++ b/Cross/config.sh-arm-linux-n770 @@ -789,6 +789,7 @@ i_sgtty='undef' i_shadow='define' i_socks='undef' i_stdbool='undef' +i_stdckdint='undef' i_stdint='define' i_stdlib='define' i_sunmath='undef' diff --git a/Porting/Glossary b/Porting/Glossary index 8b2965ca99c6..abea6f9acb64 100644 --- a/Porting/Glossary +++ b/Porting/Glossary @@ -3722,6 +3722,11 @@ i_stdbool (i_stdbool.U): indicates to the C program that exists and should be included. +i_stdckdint (i_stdckdint.U): + This variable conditionally defines the I_STDCKDINT symbol, which + indicates to the C program that exists and should + be included. + i_stdint (i_stdint.U): This variable conditionally defines the I_STDINT symbol, which indicates to the C program that exists and should diff --git a/Porting/config.sh b/Porting/config.sh index e290aa0bff64..da742d9c6ca3 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -813,6 +813,7 @@ i_sgtty='undef' i_shadow='define' i_socks='define' i_stdbool='define' +i_stdckdint='undef' i_stdint='define' i_stdlib='define' i_sunmath='undef' diff --git a/config_h.SH b/config_h.SH index ffaab1fb995e..9f7082e9c614 100755 --- a/config_h.SH +++ b/config_h.SH @@ -3842,6 +3842,12 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un */ #$i_stdbool I_STDBOOL /**/ +/* I_STDCKDINT: + * This symbol, if defined, indicates that exists and + * can be included. + */ +#$i_stdckdint I_STDCKDINT /**/ + /* I_STDINT: * This symbol, if defined, indicates that exists and * should be included. diff --git a/configure.com b/configure.com index 7c38711bb85d..f800aecc6ea0 100644 --- a/configure.com +++ b/configure.com @@ -3667,6 +3667,12 @@ $ d_fd_set="define" $ echo4 "Well, your system knows about the normal fd_set typedef..." $ ENDIF $! +$! Check for stdckdint.h +$! +$ tmp = "stdckdint.h" +$ GOSUB inhdr +$ i_stdckdint = tmp +$! $! Check for stdint.h $! $ tmp = "stdint.h" @@ -6550,6 +6556,7 @@ $ WC "i_stdbool='define'" $ ELSE $ WC "i_stdbool='undef'" $ ENDIF +$ WC "i_stdckdint='" + i_stdckdint + "'" $ WC "i_stdint='" + i_stdint + "'" $ WC "i_stdlib='define'" $ WC "i_sunmath='undef'" diff --git a/inline.h b/inline.h index fa132e2cb2e3..fa55325db3c5 100644 --- a/inline.h +++ b/inline.h @@ -3456,8 +3456,11 @@ S_lossless_NV_to_IV(const NV nv, IV *ivp) # define IV_MUL_OVERFLOW_IS_EXPENSIVE (IVSIZE > PTRSIZE) # endif +# ifdef I_STDCKDINT +# include +# endif + # if defined(I_STDCKDINT) && !IV_ADD_SUB_OVERFLOW_IS_EXPENSIVE -/* XXX Preparation for upcoming C23, but I_STDCKDINT is not yet tested */ # define S_iv_add_may_overflow(il, ir, result) ckd_add(result, il, ir) # elif defined(HAS_BUILTIN_ADD_OVERFLOW) && !IV_ADD_SUB_OVERFLOW_IS_EXPENSIVE # define S_iv_add_may_overflow __builtin_add_overflow @@ -3485,7 +3488,6 @@ S_iv_add_may_overflow (IV il, IV ir, IV *const result) */ # if defined(I_STDCKDINT) -/* XXX Preparation for upcoming C23, but I_STDCKDINT is not yet tested */ # define S_uv_add_overflow(auv, buv, result) ckd_add(result, auv, buv) # elif defined(HAS_BUILTIN_ADD_OVERFLOW) # define S_uv_add_overflow __builtin_add_overflow @@ -3502,7 +3504,6 @@ S_uv_add_overflow (UV auv, UV buv, UV *const result) # endif # if defined(I_STDCKDINT) && !IV_ADD_SUB_OVERFLOW_IS_EXPENSIVE -/* XXX Preparation for upcoming C23, but I_STDCKDINT is not yet tested */ # define S_iv_sub_may_overflow(il, ir, result) ckd_sub(result, il, ir) # elif defined(HAS_BUILTIN_SUB_OVERFLOW) && !IV_ADD_SUB_OVERFLOW_IS_EXPENSIVE # define S_iv_sub_may_overflow __builtin_sub_overflow @@ -3524,7 +3525,6 @@ S_iv_sub_may_overflow (IV il, IV ir, IV *const result) # endif # if defined(I_STDCKDINT) -/* XXX Preparation for upcoming C23, but I_STDCKDINT is not yet tested */ # define S_uv_sub_overflow(auv, buv, result) ckd_sub(result, auv, buv) # elif defined(HAS_BUILTIN_SUB_OVERFLOW) # define S_uv_sub_overflow __builtin_sub_overflow @@ -3537,7 +3537,6 @@ S_uv_sub_overflow (UV auv, UV buv, UV *const result) # endif # if defined(I_STDCKDINT) && !IV_MUL_OVERFLOW_IS_EXPENSIVE -/* XXX Preparation for upcoming C23, but I_STDCKDINT is not yet tested */ # define S_iv_mul_may_overflow(il, ir, result) ckd_mul(result, il, ir) # elif defined(HAS_BUILTIN_MUL_OVERFLOW) && !IV_MUL_OVERFLOW_IS_EXPENSIVE # define S_iv_mul_may_overflow __builtin_mul_overflow @@ -3565,7 +3564,6 @@ S_iv_mul_may_overflow (IV il, IV ir, IV *const result) # endif # if defined(I_STDCKDINT) -/* XXX Preparation for upcoming C23, but I_STDCKDINT is not yet tested */ # define S_uv_mul_overflow(auv, buv, result) ckd_mul(result, auv, buv) # elif defined(HAS_BUILTIN_MUL_OVERFLOW) # define S_uv_mul_overflow __builtin_mul_overflow diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample index d84e58c67e64..8e268ba1a8c8 100644 --- a/plan9/config_sh.sample +++ b/plan9/config_sh.sample @@ -785,6 +785,7 @@ i_sgtty='undef' i_shadow='undef' i_socks='undef' i_stdbool='undef' +i_stdckdint='undef' i_stdint='undef' i_stdlib='define' i_sunmath='undef' diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 06fa77438c3e..c22bfa0bca1f 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -275,6 +275,10 @@ L section, instead. =item * +C23 F<< >> and associated macros are now used if available. + +=item * + XXX =back diff --git a/win32/config.gc b/win32/config.gc index 34aa8de6ed75..017c14d30abc 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -782,6 +782,7 @@ i_sgtty='undef' i_shadow='undef' i_socks='undef' i_stdbool='define' +i_stdckdint='undef' i_stdint='define' i_stdlib='define' i_sunmath='undef' diff --git a/win32/config.vc b/win32/config.vc index 536085fe94e0..78e4a67c548d 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -781,6 +781,7 @@ i_sgtty='undef' i_shadow='undef' i_socks='undef' i_stdbool='undef' +i_stdckdint='undef' i_stdint='undef' i_stdlib='define' i_sunmath='undef' diff --git a/win32/config_H.gc b/win32/config_H.gc index 5add8e5a6b52..24c5f64fcfad 100644 --- a/win32/config_H.gc +++ b/win32/config_H.gc @@ -3801,6 +3801,12 @@ */ #define I_STDBOOL /**/ +/* I_STDCKDINT: + * This symbol, if defined, indicates that exists and + * can be included. + */ +/*#define I_STDCKDINT / **/ + /* I_STDINT: * This symbol, if defined, indicates that exists and * should be included. diff --git a/win32/config_H.vc b/win32/config_H.vc index 9a50246dce2f..5971f97f7a51 100644 --- a/win32/config_H.vc +++ b/win32/config_H.vc @@ -3801,6 +3801,12 @@ */ /*#define I_STDBOOL / **/ +/* I_STDCKDINT: + * This symbol, if defined, indicates that exists and + * can be included. + */ +/*#define I_STDCKDINT / **/ + /* I_STDINT: * This symbol, if defined, indicates that exists and * should be included.