[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 sublimit ~]$ cat test.c
> int main(void) {
>     int x, y = 1;
>     if (y || x)
>         x = 1;
>     return 0;
> }
> 
> [rmccabe 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.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]