From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabio M. Di Nitto Date: Thu, 30 Aug 2007 18:59:22 +0100 Subject: [Cluster-devel] [RFC] Switch the entire project to use -Werror In-Reply-To: <20070830175329.GA156481@redhat.com> References: <46D11608.5060501@ubuntu.com> <20070830173846.GW17551@redhat.com> <20070830175329.GA156481@redhat.com> Message-ID: <46D7057A.8030403@ubuntu.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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).@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.