Re: buildworld fails with warning in usr.bin/diff/diffreg.c

2017-04-24 Thread Dimitry Andric

> On 24 Apr 2017, at 20:26, Brooks Davis  wrote:
> 
> 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

2017-04-24 Thread Brooks Davis
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

2017-04-24 Thread Hamza Sheikh
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"


buildworld fails with warning in usr.bin/diff/diffreg.c

2017-04-24 Thread Hamza Sheikh
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
--- all_subdir_share ---
--- ucred.9.gz ---
gzip -cn /home/vagrant/src/share/man/man9/ucred.9 > ucred.9.gz
--- uidinfo.9.gz ---
gzip -cn /home/vagrant/src/share/man/man9/uidinfo.9 > uidinfo.9.gz
--- uio.9.gz ---
gzip -cn /home/vagrant/src/share/man/man9/uio.9 > uio.9.gz
--- all_subdir_usr.bin ---
*** [diffreg.o] Error code 1

make[4]: stopped in /home/vagrant/src/usr.bin/diff
1 error

make[4]: stopped in /home/vagrant/src/usr.bin/diff
--- all_subdir_share ---
A failure has been detected in another branch of the parallel make

make[5]: stopped in /home/vagrant/src/share/man/man9
--- all_subdir_usr.bin ---
*** [all_subdir_usr.bin/diff] Error code 2

make[3]: stopped in /home/vagrant/src/usr.bin
1 error
--- all_subdir_share ---
*** [all_subdir_share/man/man9] Error code 2

make[4]: stopped in /home/vagrant/src/share/man
1 error

make[4]: stopped in /home/vagrant/src/share/man
*** [all_subdir_share/man] Error code 2

make[3]: stopped in /home/vagrant/src/share
1 error

make[3]: stopped in /home/vagrant/src/share
--- all_subdir_usr.bin ---

make[3]: stopped in /home/vagrant/src/usr.bin
--- all_subdir_share ---
*** [all_subdir_share] Error code 2

make[2]: stopped in /home/vagrant/src
--- all_subdir_usr.bin ---
*** [all_subdir_usr.bin] Error code 2

make[2]: stopped in /home/vagrant/src
--- all_subdir_lib ---
A failure has been detected in another branch of the parallel make

make[8]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp/tests
*** [grp_test] Error code 2

make[7]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp/tests
1 error

make[7]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp/tests
*** [all_subdir_lib/libcasper/services/cap_grp/tests] Error code 2

make[6]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp
1 error

make[6]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp
*** [all_subdir_lib/libcasper/services/cap_grp] Error code 2

make[5]: stopped in /home/vagrant/src/lib/libcasper/services
1 error

make[5]: stopped in /home/vagrant/src/lib/libcasper/services
*** [all_subdir_lib/libcasper/services] Error code 2

make[4]: stopped in /home/vagrant/src/lib/libcasper
1 error

make[4]: stopped in /home/vagrant/src/lib/libcasper
*** [all_subdir_lib/libcasper] Error code 2

make[3]: stopped in /home/vagrant/src/lib
1 error

make[3]: stopped in /home/vagrant/src/lib
*** [all_subdir_lib] Error code 2

make[2]: stopped in /home/vagrant/src
--- all_subdir_usr.sbin ---
A failure has been detected in another branch of the parallel make

make[4]: stopped in /home/vagrant/src/usr.sbin/ctld
*** [all_subdir_usr.sbin/ctld] Error code 2

make[3]: stopped in /home/vagrant/src/usr.sbin
1 error

make[3]: stopped in /home/vagrant/src/usr.sbin
*** [all_subdir_usr.sbin] Error code 2

make[2]: stopped in /home/vagrant/src
4 errors

make[2]: stopped in /home/vagrant/src
*** [everything] Error code 2

make[1]: stopped in /home/vagrant/src
1 error

make[1]: stopped in /home/vagrant/src
*** [buildworld] Error code 2

make: stopped in /home/vagrant/src
1 error

make: stopped in /home/vagrant/src

Command exit status: 2







This is what the code snippet in the file looks like when error is encountered:

vagrant@freebsd12current:~/src/usr.bin/diff % awk 'NR>=1080&<=1090' diffreg.c
change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d,
int *pflags)
{
static size_t max_context = 64;
long curpos;
int i, nc;
const char *walk;

restart:
if ((diff_format != D_IFDEF || diff_format == D_GFORMAT) &&
a > b && c > d)







The following snippet removes the error during build:

vagrant@freebsd12current:~/src/usr.bin/diff % awk 'NR>=1080&<=1091' diffreg.c
change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d,
int *pflags)
{
static size_t max_context = 64;
long curpos;
int i, nc;
int 0;
const char *walk;

restart:
if ((diff_format != D_IFDEF || diff_format == D_GFORMAT) &&
a > b && c > d)







vagrant@freebsd12current:~/src % svnlite info
Path: .
Working Copy Root Path: /home/vagrant/src
URL: svn://svn.freebsd.org/base/head
Relative URL: ^/head
Repository Root: svn://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 317257
Node Kind: directory
Schedule: normal
Last Changed Author: bde
Last Changed Rev: 317256
Last Changed Date: 2017-04-21 15:12:43 + (Fri, 21 Apr 2017)



---
Hamza Sheikh
Twitter: @aikchar
___
freebsd-current@freebsd.org mailing list

buildworld fails with warning in usr.bin/diff/diffreg.c

2017-04-21 Thread Hamza Sheikh
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
--- all_subdir_share ---
--- ucred.9.gz ---
gzip -cn /home/vagrant/src/share/man/man9/ucred.9 > ucred.9.gz
--- uidinfo.9.gz ---
gzip -cn /home/vagrant/src/share/man/man9/uidinfo.9 > uidinfo.9.gz
--- uio.9.gz ---
gzip -cn /home/vagrant/src/share/man/man9/uio.9 > uio.9.gz
--- all_subdir_usr.bin ---
*** [diffreg.o] Error code 1

make[4]: stopped in /home/vagrant/src/usr.bin/diff
1 error

make[4]: stopped in /home/vagrant/src/usr.bin/diff
--- all_subdir_share ---
A failure has been detected in another branch of the parallel make

make[5]: stopped in /home/vagrant/src/share/man/man9
--- all_subdir_usr.bin ---
*** [all_subdir_usr.bin/diff] Error code 2

make[3]: stopped in /home/vagrant/src/usr.bin
1 error
--- all_subdir_share ---
*** [all_subdir_share/man/man9] Error code 2

make[4]: stopped in /home/vagrant/src/share/man
1 error

make[4]: stopped in /home/vagrant/src/share/man
*** [all_subdir_share/man] Error code 2

make[3]: stopped in /home/vagrant/src/share
1 error

make[3]: stopped in /home/vagrant/src/share
--- all_subdir_usr.bin ---

make[3]: stopped in /home/vagrant/src/usr.bin
--- all_subdir_share ---
*** [all_subdir_share] Error code 2

make[2]: stopped in /home/vagrant/src
--- all_subdir_usr.bin ---
*** [all_subdir_usr.bin] Error code 2

make[2]: stopped in /home/vagrant/src
--- all_subdir_lib ---
A failure has been detected in another branch of the parallel make

make[8]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp/tests
*** [grp_test] Error code 2

make[7]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp/tests
1 error

make[7]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp/tests
*** [all_subdir_lib/libcasper/services/cap_grp/tests] Error code 2

make[6]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp
1 error

make[6]: stopped in /home/vagrant/src/lib/libcasper/services/cap_grp
*** [all_subdir_lib/libcasper/services/cap_grp] Error code 2

make[5]: stopped in /home/vagrant/src/lib/libcasper/services
1 error

make[5]: stopped in /home/vagrant/src/lib/libcasper/services
*** [all_subdir_lib/libcasper/services] Error code 2

make[4]: stopped in /home/vagrant/src/lib/libcasper
1 error

make[4]: stopped in /home/vagrant/src/lib/libcasper
*** [all_subdir_lib/libcasper] Error code 2

make[3]: stopped in /home/vagrant/src/lib
1 error

make[3]: stopped in /home/vagrant/src/lib
*** [all_subdir_lib] Error code 2

make[2]: stopped in /home/vagrant/src
--- all_subdir_usr.sbin ---
A failure has been detected in another branch of the parallel make

make[4]: stopped in /home/vagrant/src/usr.sbin/ctld
*** [all_subdir_usr.sbin/ctld] Error code 2

make[3]: stopped in /home/vagrant/src/usr.sbin
1 error

make[3]: stopped in /home/vagrant/src/usr.sbin
*** [all_subdir_usr.sbin] Error code 2

make[2]: stopped in /home/vagrant/src
4 errors

make[2]: stopped in /home/vagrant/src
*** [everything] Error code 2

make[1]: stopped in /home/vagrant/src
1 error

make[1]: stopped in /home/vagrant/src
*** [buildworld] Error code 2

make: stopped in /home/vagrant/src
1 error

make: stopped in /home/vagrant/src

Command exit status: 2







This is what the code snippet in the file looks like when error is encountered:

vagrant@freebsd12current:~/src/usr.bin/diff % awk 'NR>=1080&<=1090' diffreg.c
change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d,
int *pflags)
{
static size_t max_context = 64;
long curpos;
int i, nc;
const char *walk;

restart:
if ((diff_format != D_IFDEF || diff_format == D_GFORMAT) &&
a > b && c > d)







The following snippet removes the error during build:

vagrant@freebsd12current:~/src/usr.bin/diff % awk 'NR>=1080&<=1091' diffreg.c
change(char *file1, FILE *f1, char *file2, FILE *f2, int a, int b, int c, int d,
int *pflags)
{
static size_t max_context = 64;
long curpos;
int i, nc;
int 0;
const char *walk;

restart:
if ((diff_format != D_IFDEF || diff_format == D_GFORMAT) &&
a > b && c > d)







vagrant@freebsd12current:~/src % svnlite info
Path: .
Working Copy Root Path: /home/vagrant/src
URL: svn://svn.freebsd.org/base/head
Relative URL: ^/head
Repository Root: svn://svn.freebsd.org/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 317257
Node Kind: directory
Schedule: normal
Last Changed Author: bde
Last Changed Rev: 317256
Last Changed Date: 2017-04-21 15:12:43 + (Fri, 21 Apr 2017)
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to