[Cluster-devel] [RFC] Switch the entire project to use -Werror

Fabio M. Di Nitto fabbione at ubuntu.com
Thu Aug 30 17:59:22 UTC 2007


Ryan McCabe wrote:

> 
> GCC can still be really stupid and issue warnings about code that's
> perfectly fine, for example:

Right.. but it is "usually" right.

> 
> [rmccabe at sublimit ~]$ cat test.c
> int main(void) {
>     int x, y = 1;
>     if (y || x)
>         x = 1;
>     return 0;
> }
> 
> [rmccabe at sublimit ~]$ gcc -O2 -Wall -Werror test.c -o test
> cc1: warnings being treated as errors
> test.c: In function ‘main’:
> test.c:3: warning: ‘x’ is used uninitialized in this function
> 

This gcc catch looks good to me.

int x, y=1; <- doesn´t init x to 1. Only y.

and you are getting a warning on if(y || x). at this point only y is
initialized. So for what I can see it is valid.

and please flame hard if i am missing the point... i just come out of an
11 hours meeting ;)

Fabio

-- 
I'm going to make him an offer he can't refuse.




More information about the Cluster-devel mailing list