PATCH: Fix a warning in test/test-skeleton.c
Khem Raj
kraj at mvista.com
Fri Oct 26 17:39:10 UTC 2007
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Rob Landley wrote:
> On Wednesday 24 October 2007 8:17:44 pm Khem Raj wrote:
>> Hi
>>
>> This patch fixes following warning that I am getting with gcc 4.2 while
>> running the tests. I also changed the type to pid_t to match with the
>> return of waitpid ()
>>
>> ../test-skeleton.c: In function 'timeout_handler':
>> ../test-skeleton.c:138: warning: 'killed' may be used uninitialized in
>> this function
>>
>>
>> OK to apply ?
>
> Note that "is uninitialized" is a warning gcc is competent to generate. "may
> be used uninitialized" is a huge source of false positive warnings in gcc,
> it's a crappy warning that should be possible to separately disable, but
> isn't. (Unless you want to patch the gcc source code to remove it.)
>
> int i,j;
>
> for (i=0;i<10;i++) {
> if (i>5) printf("%d\n",j);
> j=i;
> }
>
> This is an example of the kind of instance where j _cannot_ be used
> uninitialized but gcc's warning generator can't tell, so emits suprious
> warnings.
>
> Extra superfulous initializations silence gcc, at the cost of bloating the
> code.
On second thought I would agree that this warning is useless in this case.
- --
Khem Raj
MontaVista Software Inc.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHIiY+UjbQJxVzeZQRAiVbAJsEINsgijpCHNQ5/sgTgXCQPVdY0gCbBIj8
P/I7dcrT6lpo931WBIrp5Ik=
=2VGc
-----END PGP SIGNATURE-----
More information about the uClibc
mailing list