]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
inttostr-tests: pacify -Wuseless-cast
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 May 2026 03:49:19 +0000 (20:49 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 May 2026 03:59:52 +0000 (20:59 -0700)
* tests/test-inttostr.c (CK): Use compound literals, not casts.

ChangeLog
tests/test-inttostr.c

index 61993fb2912dfb8a7875d208f958f4906fa39166..3e2fc600cc09c33997703c377a5ab1d3a430cab6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2026-05-10  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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 *.
index 1edb420735600ae10c569a4758129a6a4ed15ab5..fec9f7af005265048c242c9c46766fcb563422d6 100644 (file)
       *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.  */         \