[3/3] conform: Add C23 checks for <limits.h>
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
| redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
| linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Test passed
|
| linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Build passed
|
| linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Test passed
|
Commit Message
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
---
conform/data/limits.h-data | 42 +++++++++++++++++++++++++++++++++++++-
1 file changed, 41 insertions(+), 1 deletion(-)
Comments
This is missing at least __STDC_VERSION_LIMITS_H__. We'll need to figure
out how to XFAIL such a test depending on the GCC version used, since
__STDC_VERSION_LIMITS_H__ was added in GCC 13 and GCC 12 is supported for
building glibc (and older versions for testing).
> +macro-int-constant BITINT_MAXWIDTH >= 64
This will also need a series of XFAILs relating to target _BitInt support,
referencing appropriate GCC bugs. (And GCC version conditional XFAILs in
the case of testing with an older GCC version than the one adding _BitInt
support for a given architecture.)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117583 (AArch64 BE)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117582 (Arm)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117589 (HPPA)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117599 (LoongArch)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117588 (M68k)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115393 (MIPS)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117584 (PowerPC)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117581 (RISC-V)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117586 (S/390)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117591 (SH)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117592 (SPARC)
And I don't see such GCC bugs open for Alpha, ARC, CSKY, MicroBlaze or
OpenRISC, but those architectures are also supported by glibc and lack
_BitInt support in GCC so will also require such bugs (which should be
dependencies of the meta-bug 117580) to reference in XFAILs for the
absence of BITINT_MAXWIDTH.
Joseph Myers <josmyers@redhat.com> writes:
> This is missing at least __STDC_VERSION_LIMITS_H__. We'll need to figure
> out how to XFAIL such a test depending on the GCC version used, since
> __STDC_VERSION_LIMITS_H__ was added in GCC 13 and GCC 12 is supported for
> building glibc (and older versions for testing).
Thanks for the explanation.
I something like:
#if __GNUC__ >= 13
macro-int-constant __STDC_VERSION_LIMITS_H__ {long} == 202311L
#else
xfail-constant __STDC_VERSION_LIMITS_H__
#endif
will work but I haven't tested it. Likewise for the other headers, until
we decide if glibc will define them.
>> +macro-int-constant BITINT_MAXWIDTH >= 64
>
> This will also need a series of XFAILs relating to target _BitInt support,
> referencing appropriate GCC bugs. (And GCC version conditional XFAILs in
> the case of testing with an older GCC version than the one adding _BitInt
> support for a given architecture.)
[..]
> And I don't see such GCC bugs open for Alpha, ARC, CSKY, MicroBlaze or
> OpenRISC, but those architectures are also supported by glibc and lack
> _BitInt support in GCC so will also require such bugs (which should be
> dependencies of the meta-bug 117580) to reference in XFAILs for the
> absence of BITINT_MAXWIDTH.
I forgot that not all platforms support _BitInt. I'll have a look.
Thanks for the links.
Collin
@@ -1,7 +1,13 @@
macro-int-constant CHAR_BIT >= 8
macro-int-constant SCHAR_MIN {promoted:signed char} <= -127
macro-int-constant SCHAR_MAX {promoted:signed char} >= 127
+#if defined ISO23
+macro-int-constant SCHAR_WIDTH >= 8
+#endif
macro-int-constant UCHAR_MAX {promoted:unsigned char} >= 255
+#if defined ISO23
+macro-int-constant UCHAR_WIDTH >= 8
+#endif
#ifdef __CHAR_UNSIGNED__
macro-int-constant CHAR_MIN {promoted:char} == 0
macro-int-constant CHAR_MAX {promoted:char} == UCHAR_MAX
@@ -9,21 +15,55 @@ macro-int-constant CHAR_MAX {promoted:char} == UCHAR_MAX
macro-int-constant CHAR_MIN {promoted:char} == SCHAR_MIN
macro-int-constant CHAR_MAX {promoted:char} == SCHAR_MAX
#endif
+#if defined ISO23
+macro-int-constant CHAR_WIDTH >= 8
+#endif
macro-int-constant MB_LEN_MAX >= 1
macro-int-constant SHRT_MIN {promoted:short int} <= -32767
macro-int-constant SHRT_MAX {promoted:short int} >= 32767
+#if defined ISO23
+macro-int-constant SHRT_WIDTH >= 16
+#endif
macro-int-constant USHRT_MAX {promoted:unsigned short int} >= 65535
-// The ranges for int and unsigned int are from POSIX.
+#if defined ISO23
+macro-int-constant USHRT_WIDTH >= 16
+#endif
+// The ranges for int and unsigned int are from POSIX, which are greater than
+// those required by ISO C.
macro-int-constant INT_MAX {int} >= 2147483647
macro-int-constant INT_MIN {int} <= -2147483647
+#if defined ISO23
+macro-int-constant INT_WIDTH >= 32
+#endif
macro-int-constant UINT_MAX {unsigned int} >= 4294967295U
+#if defined ISO23
+macro-int-constant UINT_WIDTH >= 32
+#endif
macro-int-constant LONG_MAX {long int} >= 2147483647L
macro-int-constant LONG_MIN {long int} <= -2147483647L
+#if defined ISO23
+macro-int-constant LONG_WIDTH >= 32
+#endif
macro-int-constant ULONG_MAX {unsigned long int} >= 4294967295UL
+#if defined ISO23
+macro-int-constant ULONG_WIDTH >= 32
+#endif
#if defined ISO99 || defined ISO11 || defined ISO23 || defined XOPEN2K8 || defined POSIX2008
macro-int-constant LLONG_MIN {long long int} <= -9223372036854775807ll
macro-int-constant LLONG_MAX {long long int} >= 9223372036854775807ll
+#if defined ISO23
+macro-int-constant LLONG_WIDTH >= 64
+#endif
macro-int-constant ULLONG_MAX {unsigned long long int} >= 18446744073709551615ull
+#if defined ISO23
+macro-int-constant ULLONG_WIDTH >= 64
+#endif
+#endif
+
+#if defined ISO23
+macro-int-constant BOOL_WIDTH >= 1
+macro-int-constant BOOL_MAX >= 1
+macro-int-constant BITINT_MAXWIDTH >= 64
#endif
#if !defined ISO && !defined ISO99 && !defined ISO11 && !defined ISO23