From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Morton To: Gerald Pfeifer Cc: "Martin v. Loewis" , meissner@cygnus.com, gcc@gcc.gnu.org Subject: Re: comparisons.. Date: Thu, 13 Jul 2000 17:12:00 -0000 Message-id: <396E5ABD.856EACF4@uow.edu.au> References: <396D78FE.C4A91B53@uow.edu.au> X-SW-Source: 2000-07/msg00427.html Gerald Pfeifer wrote: > > On Thu, 13 Jul 2000, Andrew Morton wrote: > > Unfortunately using `-W' in the kernel makefiles generates a truckload > > of warnings. Is there a way of unbundling the `if (unsigned < 0)' > > warning with a standalone flag? > > The questions is: Are the other warnings warranted or not? :-) It generated nine megs of warnings total! Yes, a lot were warranted, but not really practical. The most useful ones were: comparison of unsigned with zero: (unsigned < 0) (unsigned >= 0) The empty `if' check found several of these: if (some_condition); statement; comparisons like X<=Y<=Z do not have their mathematical meaning This happened rarely and was 100% correlated with wrong code. > You already found several bugs in the kernel, perhaps there are further > ones still in there? And, of course, if you receive warnings you consider > inappropriate (bugs in the compiler?), please let us know! There are probably some bugs hiding behind "comparison between signed and unsigned", but I didn't check these - there were many hundreds. I'm told that the compiler will warn for this code: unsigned int i; if (i > 5) /* 'i' is unsigned, '5' is signed, so warn */ which makes this warning hard to use more than occasionally.