PATCH: Fix a warning in test/test-skeleton.c
Rob Landley
rob at landley.net
Thu Oct 25 07:34:36 UTC 2007
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.
Rob
--
"One of my most productive days was throwing away 1000 lines of code."
- Ken Thompson.
More information about the uClibc
mailing list