Bruno Haible wrote: > I'm also having similar warnings in the *list modules and in GNU clisp. > >> Since I require warning free compilation with -Wuninitialized, >> I am considering this patch. Would you prefer to avoid the >> warning in a different manner? > > Well, I would prefer if the inaccuracy of the warnings be acknowledged by > the GCC developers. Has it already been reported?
I don't know. This "new" warning is being exposed because gcc's use analysis can now span function boundaries. > We already have an IF_LINT macro in this file. Let's extend it so that it can > be used in this case as well. Users GCC < 3.0 will now see more warnings, but > they can upgrade to a newer GCC anyway. This avoids to have #if inside > functions for such a trivial stuff. Applying this: Please do not push that, at least not with my name on it... > 2009-11-21 Jim Meyering <meyer...@redhat.com> > Bruno Haible <br...@clisp.org> > > diffseq: avoid spurious gcc warnings > * lib/diffseq.h (IF_LINT): Enable only with GCC >= 3.0. > (compareseq): Initialize two members of "part" to avoid used- > uninitialized warnings. > > --- lib/diffseq.h.orig 2009-11-21 18:39:58.000000000 +0100 > +++ lib/diffseq.h 2009-11-21 18:34:58.000000000 +0100 > @@ -68,9 +68,10 @@ > # define EARLY_ABORT(ctxt) false > #endif > > -/* Use this to suppress gcc's `...may be used before initialized' warnings. > */ > +/* Use this to suppress gcc's `...may be used before initialized' warnings. > + The Code argument may contain syntax that assumes GCC 3.0 or newer. */ > #ifndef IF_LINT > -# ifdef lint > +# if defined lint && __GNUC__ >= 3 > # define IF_LINT(Code) Code > # else > # define IF_LINT(Code) /* empty */ > @@ -464,7 +465,7 @@ > } > else > { > - struct partition part; > + struct partition part IF_LINT (= { .xmid = 0, .ymid = 0 }); Any code using a one-argument macro like that is rejected, due to the comma: ../lib/diffseq.h:467:64: error: macro "IF_LINT" passed 2 arguments,\ but takes just 1 FYI, I tried the same thing before writing the #if-adding patch.