* tests/test-inttostr.c (CK): Use compound literals, not casts.
---
 ChangeLog             | 3 +++
 tests/test-inttostr.c | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 61993fb291..3e2fc600cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2026-05-10  Paul Eggert  <[email protected]>
 
+       inttostr-tests: pacify -Wuseless-cast
+       * tests/test-inttostr.c (CK): Use compound literals, not casts.
+
        unilbrk/ulc-width-linebreaks: omit no-op casts
        * lib/unilbrk/ulc-width-linebreaks.c (ulc_width_linebreaks_internal):
        Omit casts from char * to char *.
diff --git a/tests/test-inttostr.c b/tests/test-inttostr.c
index 1edb420735..fec9f7af00 100644
--- a/tests/test-inttostr.c
+++ b/tests/test-inttostr.c
@@ -46,16 +46,16 @@
       *buf = '\0';                                                      \
       ASSERT                                                            \
         ((TYPE_SIGNED (T)                                               \
-          ? snprintf (ref, sizeof ref, "%jd", (intmax_t) TYPE_MINIMUM (T)) \
-          : snprintf (ref, sizeof ref, "%ju", (uintmax_t) TYPE_MINIMUM (T))) \
+          ? snprintf (ref, sizeof ref, "%jd", (intmax_t) {TYPE_MINIMUM (T)}) \
+          : snprintf (ref, sizeof ref, "%ju", (uintmax_t) {TYPE_MINIMUM (T)})) 
\
          < sizeof ref);                                                 \
       ASSERT (streq ((p = Fn (TYPE_MINIMUM (T), buf)), ref));           \
       /* Ensure that INT_BUFSIZE_BOUND is tight for signed types.  */   \
       ASSERT (! TYPE_SIGNED (T) || (p == buf && *p == '-'));            \
       ASSERT                                                            \
         ((TYPE_SIGNED (T)                                               \
-          ? snprintf (ref, sizeof ref, "%jd", (intmax_t) TYPE_MAXIMUM (T)) \
-          : snprintf (ref, sizeof ref, "%ju", (uintmax_t) TYPE_MAXIMUM (T))) \
+          ? snprintf (ref, sizeof ref, "%jd", (intmax_t) {TYPE_MAXIMUM (T)}) \
+          : snprintf (ref, sizeof ref, "%ju", (uintmax_t) {TYPE_MAXIMUM (T)})) 
\
          < sizeof ref);                                                 \
       ASSERT (streq ((p = Fn (TYPE_MAXIMUM (T), buf)), ref));           \
       /* For unsigned types, the bound is not always tight.  */         \
-- 
2.54.0


Reply via email to