Re: buildworld fails with warning in usr.bin/diff/diffreg.c
> On 24 Apr 2017, at 20:26, Brooks Daviswrote: > > On Mon, Apr 24, 2017 at 10:04:15AM -0700, Hamza Sheikh wrote: >> The error is: >> >> --- all_subdir_usr.bin --- >> cc1: warnings being treated as errors >> /home/vagrant/src/usr.bin/diff/diffreg.c: In function 'change': >> /home/vagrant/src/usr.bin/diff/diffreg.c:1085: warning: 'i' may be >> used uninitialized in this function > > If I'm reading the code correctly, this is caused by this code at line > 1217 and the analyzer being insufficiently smart (all prior uses include > initialization in for() loops): > >if (diff_format != D_GFORMAT) >i = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : > '\0', 0, *pflags); >if (i != 0 && diff_format == D_EDIT) { > > Adding "i = 0;" above this fixes the warning for me and appears to > preserve the intent. This variable should be named something other than > i to avoid confusion. See also https://reviews.freebsd.org/D10462 . Sorry for slacking off on that. :) -Dimitry signature.asc Description: Message signed with OpenPGP
Re: buildworld fails with warning in usr.bin/diff/diffreg.c
On Mon, Apr 24, 2017 at 10:04:15AM -0700, Hamza Sheikh wrote: > The error is: > > --- all_subdir_usr.bin --- > cc1: warnings being treated as errors > /home/vagrant/src/usr.bin/diff/diffreg.c: In function 'change': > /home/vagrant/src/usr.bin/diff/diffreg.c:1085: warning: 'i' may be > used uninitialized in this function If I'm reading the code correctly, this is caused by this code at line 1217 and the analyzer being insufficiently smart (all prior uses include initialization in for() loops): if (diff_format != D_GFORMAT) i = fetch(ixnew, c, d, f2, diff_format == D_NORMAL ? '>' : '\0', 0, *pflags); if (i != 0 && diff_format == D_EDIT) { Adding "i = 0;" above this fixes the warning for me and appears to preserve the intent. This variable should be named something other than i to avoid confusion. -- Brooks signature.asc Description: PGP signature
Re: buildworld fails with warning in usr.bin/diff/diffreg.c
I'm sorry for the double post. I got confused by the filtering as I had not subscribed to the list when I sent the first post. ___ freebsd-current@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"