bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 08/10] Fix up a bunch of "gcc -Werror=sign-compare" compla


From: Paul Eggert
Subject: Re: [PATCH v2 08/10] Fix up a bunch of "gcc -Werror=sign-compare" complaints
Date: Wed, 8 Dec 2021 10:54:58 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.1

On 12/8/21 07:48, Bruno Haible wrote:

2) When I collect all warnings in the gllib/ directory of a full testdir,
I get (with gcc-9.3):

Typically, I don't worry much about warnings by older GCCs, as it's enough of a pain to worry about the latest version.

Like Jim I don't have strong feelings about this, but here are some comments anyway....


I therefore propose to disable these warnings:

   -Wattribute-warning
I haven't dealt with this much, since gcc-warning.spec means it's not used by the packages I help maintain. Could you give examples of why it misfires on Gnulib?


  -Wcast-qual
  -Wconversion
  -Wfloat-conversion
  -Wfloat-equal
  -Wpedantic
  -Wsign-conversion
  -Wundef
  -Wunsuffixed-float-constants
These aren't enabled by -Wall -Wextra. So I assume that gnulib-tool would be appending -Wno-cast-qual etc. to disable these even if the main CFLAGS enables them? (And I guess similarly for all the flags.)


   -Wimplicit-fallthrough
I typically use -Wimplicit-fallthrough=5; would it be OK to standardize on that in Gnulib?


   -Wmaybe-uninitialized
I find this one useful as it catches real bugs. Admittedly it is a pain because it also has quite a few false alarms. At RMS's suggestion Emacs does something like this in config.h:

  #ifdef GCC_LINT
  # define UNINIT = {0,}
  #else
  # define UNINIT /* empty */
  #endif

and something like this in configure.ac:

  AS_IF([test $gl_gcc_warnings = no],
    AC_DEFINE([GCC_LINT], [1], [Define to 1 if --enable-gcc-warnings.]))

and this in source files for variables that would otherwise be warned about with the latest GCC:

   char *p UNINIT;

Perhaps we should move this idea into Gnulib?


   -Wrestrict
This one seems like it could find real bugs; could you give an example or two of misfires? Perhaps we could disable it in individual files that play nonstandard games with pointers.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]