bug-gnulib
[Top][All Lists]
Advanced

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

silence some gcc -Wmaybe-uninitialized warnings


From: Bruno Haible
Subject: silence some gcc -Wmaybe-uninitialized warnings
Date: Fri, 19 May 2023 00:09:03 +0200

Hi Paul,

Regarding these two warnings:

 * -O1, -O2, -O3, -Og, -Os only:
 ../../gllib/getndelim2.c:191:23: warning: 'c' may be used uninitialized 
[-Wmaybe-uninitialized]
 
 * -O2, -O3 only:
 ../../gllib/canonicalize.c:385:33: warning: 'end_idx' may be used 
uninitialized [-Wmaybe-uninitialized]

I'm seeing these warnings, although an IF_LINT invocation is meant to suppress
them.

Some time ago, a distro guy explained on this list that IF_LINT does not
help in their situation, because the distro wants to build each package
once, with the settings that produce the best code, _and_ have the compiler
report warnings for this situation.

I'm in a similar situation: When I compile gnulib testdirs or gettext, I
don't want to have two different ways to compile it: once for getting
the warnings and once for getting the binaries, that I then run through
"make check" (optionally with valgrind).

So the IF_LINT mechanism does not work well for me either.

How about the following patches? They replace two uses of IF_LINT with
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized".
The loss for reliability is small: it silences the "maybe uninitialized"
findings for an entire function, instead of just for one variable.
The upside is that it removes the warning on glibc systems and thereby
helps the human developer (me) focusing on real warnings produced by gcc.

Is that OK with you, or do you have objections?

Bruno

Attachment: 0001-canonicalize-Silence-gcc-warning.patch
Description: Text Data

Attachment: 0002-getndelim2-Silence-gcc-warning.patch
Description: Text Data


reply via email to

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