[PATCH] AC_C_CONST: support -Werror=unused-but-set-variable with GCC 16
Vincent Lefevre <[email protected]> Thu, 7 Aug 2025 17:24:01 +0200
| Newsgroups | gmane.comp.sysutils.autoconf.patches |
|---|---|
| Message-ID | <[email protected]> |
Needed with gcc r16-2258-g0eac9cfee8cb0b21d, which extends -Wunused-but-set-* warnings: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44677#c25 Signed-off-by: Vincent Lefevre <[email protected]> --- lib/autoconf/c.m4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4 index 4cdb2995..3705d028 100644 --- a/lib/autoconf/c.m4 +++ b/lib/autoconf/c.m4 @@ -2141,11 +2141,13 @@ AC_DEFUN([AC_C_CONST], int x[] = {25, 17}; const int *foo = &x[0]; ++foo; + if (!foo) return 0; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; + if (!p) return 0; } { /* IBM XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ -- 2.50.1