On Fri, Mar 29, 2024 at 2:15 PM Martin Dorey <invalid.nore...@gnu.org> wrote: > > URL: > <https://savannah.gnu.org/bugs/?65537> > > Summary: Werrors from intprops-internal.h with gcc 8.3.0 > Group: make > Submitter: mdorey > Submitted: Fri 29 Mar 2024 11:14:56 AM PDT > Severity: 3 - Normal > Item Group: Build/Install > Status: None > Privacy: Public > Assigned to: None > Open/Closed: Open > Discussion Lock: Any > Component Version: SCM > Operating System: POSIX-Based > Fixed Release: None > Triage Status: None > > > _______________________________________________________ > > Follow-up Comments: > > > ------------------------------------------------------- > Date: Fri 29 Mar 2024 11:14:56 AM PDT By: Martin Dorey <mdorey> > A fresh git clone of Gnu Make fails to build for me on Debian 10/Buster with: > > mv -f $depbase.Tpo $depbase.Po > In file included from lib/intprops.h:21, > from src/arscan.c:379: > src/arscan.c: In function ‘parse_int’: > lib/intprops-internal.h:39:59: error: comparison of unsigned expression < 0 is > always false [-Werror=type-limits] > #define _GL_EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) > ^ > lib/intprops-internal.h:166:42: note: in expansion of macro > ‘_GL_EXPR_SIGNED’ > ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && > _GL_EXPR_SIGNED (b) \ > ^~~~~~~~~~~~~~~ > lib/intprops.h:302:37: note: in expansion of macro > ‘_GL_INT_MULTIPLY_WRAPV’ > #define INT_MULTIPLY_WRAPV(a, b, r) _GL_INT_MULTIPLY_WRAPV (a, b, r) > ^~~~~~~~~~~~~~~~~~~~~~ > src/arscan.c:399:14: note: in expansion of macro ‘INT_MULTIPLY_WRAPV’ > || INT_MULTIPLY_WRAPV (val, base, &val) > ^~~~~~~~~~~~~~~~~~ > lib/intprops-internal.h:372:11: error: comparison of unsigned expression < 0 > is always false [-Werror=type-limits] > ? ((a) < 0 \ > ^ > lib/intprops-internal.h:167:10: note: in expansion of macro > ‘_GL_INT_MULTIPLY_RANGE_OVERFLOW’ > && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) > \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lib/intprops.h:302:37: note: in expansion of macro > ‘_GL_INT_MULTIPLY_WRAPV’ > #define INT_MULTIPLY_WRAPV(a, b, r) _GL_INT_MULTIPLY_WRAPV (a, b, r) > ^~~~~~~~~~~~~~~~~~~~~~ > src/arscan.c:399:14: note: in expansion of macro ‘INT_MULTIPLY_WRAPV’ > || INT_MULTIPLY_WRAPV (val, base, &val) > ^~~~~~~~~~~~~~~~~~ > lib/intprops-internal.h:39:59: error: comparison of unsigned expression < 0 is > always false [-Werror=type-limits] > #define _GL_EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) > ^ > lib/intprops-internal.h:373:10: note: in expansion of macro > ‘_GL_EXPR_SIGNED’ > ? (_GL_EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ > ^~~~~~~~~~~~~~~ > lib/intprops-internal.h:167:10: note: in expansion of macro > ‘_GL_INT_MULTIPLY_RANGE_OVERFLOW’ > && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) > \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lib/intprops.h:302:37: note: in expansion of macro > ‘_GL_INT_MULTIPLY_WRAPV’ > #define INT_MULTIPLY_WRAPV(a, b, r) _GL_INT_MULTIPLY_WRAPV (a, b, r) > ^~~~~~~~~~~~~~~~~~~~~~ > src/arscan.c:399:14: note: in expansion of macro ‘INT_MULTIPLY_WRAPV’ > || INT_MULTIPLY_WRAPV (val, base, &val) > ^~~~~~~~~~~~~~~~~~ > lib/intprops-internal.h:39:59: error: comparison of unsigned expression < 0 is > always false [-Werror=type-limits] > #define _GL_EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) > ^ > lib/intprops-internal.h:380:10: note: in expansion of macro > ‘_GL_EXPR_SIGNED’ > ? (_GL_EXPR_SIGNED (a) \ > ^~~~~~~~~~~~~~~ > lib/intprops-internal.h:167:10: note: in expansion of macro > ‘_GL_INT_MULTIPLY_RANGE_OVERFLOW’ > && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) > \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lib/intprops.h:302:37: note: in expansion of macro > ‘_GL_INT_MULTIPLY_WRAPV’ > #define INT_MULTIPLY_WRAPV(a, b, r) _GL_INT_MULTIPLY_WRAPV (a, b, r) > ^~~~~~~~~~~~~~~~~~~~~~ > src/arscan.c:399:14: note: in expansion of macro ‘INT_MULTIPLY_WRAPV’ > || INT_MULTIPLY_WRAPV (val, base, &val) > ^~~~~~~~~~~~~~~~~~ > lib/intprops-internal.h:382:35: error: comparison of integer expressions of > different signedness: ‘int’ and ‘uintmax_t’ {aka ‘long unsigned > int’} [-Werror=sign-compare] > : 0 < (a) && -1 - (tmin) < (a) - 1) \ > ^ > lib/intprops-internal.h:167:10: note: in expansion of macro > ‘_GL_INT_MULTIPLY_RANGE_OVERFLOW’ > && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) > \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lib/intprops.h:302:37: note: in expansion of macro > ‘_GL_INT_MULTIPLY_WRAPV’ > #define INT_MULTIPLY_WRAPV(a, b, r) _GL_INT_MULTIPLY_WRAPV (a, b, r) > ^~~~~~~~~~~~~~~~~~~~~~ > src/arscan.c:399:14: note: in expansion of macro ‘INT_MULTIPLY_WRAPV’ > || INT_MULTIPLY_WRAPV (val, base, &val) > ^~~~~~~~~~~~~~~~~~ > lib/intprops-internal.h:386:11: error: comparison of unsigned expression < 0 > is always false [-Werror=type-limits] > : ((a) < 0 \ > ^ > lib/intprops-internal.h:167:10: note: in expansion of macro > ‘_GL_INT_MULTIPLY_RANGE_OVERFLOW’ > && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) > \ > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > lib/intprops.h:302:37: note: in expansion of macro > ‘_GL_INT_MULTIPLY_WRAPV’ > #define INT_MULTIPLY_WRAPV(a, b, r) _GL_INT_MULTIPLY_WRAPV (a, b, r) > ^~~~~~~~~~~~~~~~~~~~~~ > src/arscan.c:399:14: note: in expansion of macro ‘INT_MULTIPLY_WRAPV’ > || INT_MULTIPLY_WRAPV (val, base, &val) > ^~~~~~~~~~~~~~~~~~ > cc1: all warnings being treated as errors > make[1]: *** [Makefile:896: src/arscan.o] Error 1 > make[1]: Leaving directory '/home/martind/download/make-2024-03-29' > make: *** [Makefile:982: all-recursive] Error 1 > martind@stormy:~/download/make-2024-03-29$ > > I'm not seriously suggesting it but, having found some mail from over a decade > ago at > https://bug-gnulib.gnu.narkive.com/IJgonyeq/test-intprops-c-many-new-warnings > suggesting ignoring the warnings here, I unblocked myself with: > > --- a/maintMakefile > +++ b/maintMakefile > @@ -32,6 +32,7 @@ PERLFLAGS := -w > MAKE_CFLAGS := -C -Wall -Wextra -Werror -Wwrite-strings -Wshadow \ > -Wdeclaration-after-statement -Wbad-function-cast -Wformat-security \ > -Wtype-limits -Wunused-but-set-parameter -Wlogical-op -Wpointer-arith > \ > + -Wno-error=type-limits -Wno-error=sign-compare \ > -Wignored-qualifiers -Wformat-signedness -Wduplicated-cond > > AM_CFLAGS += $(MAKE_CFLAGS) > > I see there's > https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=4d38340a76dbee56036a5fcc0f052ebcff616a59 > upstream, though not in Gnu Make. I don't understand the macro guard there. > Why would Paul Eggert want to avoid using the pragma in the half-open region > between gcc 4.4 and gcc 5, while using it for the half-open region from gcc > 4.0 to gcc 4.4? I wondered if it was to do with when support for disabling > warnings was added, but failed to chase down when that was. The comment > mentions a version after 13.2 changing behavior, so I wonder if he intended a > change from 13.3 on, which could be expressed as 14 <= __GNUC__ + (3 <= > __GNUC_MINOR__), which is only two characters different from what was > committed.
If I am not mistaken, the 4d3834 commit uses the wrong pragma: +/* Pacify GCC 13.2 in some calls to _GL_EXPR_SIGNED. */ +#if defined __GNUC__ && 4 < __GNUC__ + (3 <= __GNUC_MINOR__) +# pragma GCC diagnostic ignored "-Wtype-limits" +#endif It should use the tautological-compare warning. Or that's the one we've been using for ages in C++. Clang had the warning before GCC, and we used it when building with Clang. #pragma GCC diagnostic ignored "-Wtautological-compare" Jeff