From: Paul Eggert Date: Fri, 8 May 2026 01:51:15 +0000 (-0700) Subject: Pacify -Wuseless cast with a pragma X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba6c8ac33bbb35346b9c828a8e53da94730eff37;p=thirdparty%2Fgnulib.git Pacify -Wuseless cast with a pragma * lib/intprops-internal.h: Ignore -Wuseless-cast. * lib/vasnprintf.c: Ignore -Wuseless-cast. --- diff --git a/ChangeLog b/ChangeLog index 3627599299..94845b5ede 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2026-05-07 Paul Eggert + Pacify -Wuseless cast with a pragma + * lib/intprops-internal.h: Ignore -Wuseless-cast. + * lib/vasnprintf.c: Ignore -Wuseless-cast. + Pacify GCC 16 -Wuseless-cast by omitting casts * lib/obstack.in.h (obstack_free): Omit unnecessary cast. * lib/printf-args.c (PRINTF_FETCHARGS): Omit unnecessary casts. diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h index 0df385b9bf..6a72c24bca 100644 --- a/lib/intprops-internal.h +++ b/lib/intprops-internal.h @@ -25,6 +25,11 @@ # pragma GCC diagnostic ignored "-Wtype-limits" #endif +/* This file uses many casts that might provoke -Wuseless-cast. */ +#if 16 <= __GNUC__ +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif + /* Return a value with the common real type of E and V and the value of V. Do not evaluate E. */ #define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index b7c1cfc880..3162fd0b8a 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -69,6 +69,11 @@ # pragma GCC diagnostic ignored "-Wanalyzer-null-argument" #endif +/* This code has a lot of parameterized pointer casts that may be no-ops. */ +#if _GL_GNUC_PREREQ (16, 0) || 11 <= __clang_major__ +# pragma GCC diagnostic ignored "-Wuseless-cast" +#endif + #include /* Specification. */