1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2026-10-24 00:48:56 +03:00

inttostr-tests: pacify -Wuseless-cast

* tests/test-inttostr.c (CK): Use compound literals, not casts.
This commit is contained in:
Paul Eggert
2026-05-10 20:49:19 -07:00
parent a4f9813971
commit 3367153db8
2 changed files with 7 additions and 4 deletions

View File

@@ -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 *.

View File

@@ -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. */ \