[libvirt] [PATCH] virDomainFormatSchedDef: Initialize @priority
Daniel P. Berrange
berrange at redhat.com
Tue Feb 9 15:53:00 UTC 2016
On Tue, Feb 09, 2016 at 09:26:33AM +0100, Peter Krempa wrote:
> On Tue, Feb 09, 2016 at 09:08:49 +0100, Michal Privoznik wrote:
> > Older gcc fails to see that the variable is set iff @hasPriority
> > == true in which case the former is set a value. Initialize the
> > value while declaring it to make the compiler shut up.
> Initializing it may confuse a next reader, since there is no default
> value that would make sense at this point.
> > Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> > ---
> > This maybe isn't the best approach, to workaround false
> > positives. I'm open to discussion.
> I'd suggest using non-broken compilers on non-ancient platforms and
> leaving the code be.
GCC has a long history of both giving false warnings about uninitialized
variables, and missing warnings about genuinely uninitialized vars, not
to mention bugs in various other warning flags. As such it is perfectly
reasonable to add stuff to the code to shutup bogus compiler warnings,
particularly when it is as simple as initializing a variable. We've done
it many times in the past already.
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list