[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adaveeaqp8q.fsf@cisco.com>
Date: Wed, 30 May 2007 08:56:37 -0700
From: Roland Dreier <rdreier@...co.com>
To: "Satyam Sharma" <satyam.sharma@...il.com>
Cc: linux-kernel@...r.kernel.org, openib-general@...nib.org
Subject: Re: [ofa-general] Re: dealing with gcc 'comparison is always false' warnings
> However, gcc is _just as correct_. It is only crying about seeing a condition
> that the programmer could have written with some purpose in mind but which
> is being completely compiled away by it when generating the code because
> of it being a tautology / contradiction ...
Well, OK, but there's lots of things gcc could warn about. How about
while (1) { ...
By your argument gcc should warn that '1' always evaluates to true.
Or how about
#if 0
why shouldn't the preprocessor warn that the conditional is always false?
> No, shutting gcc up wouldn't be the right thing, IMHO. These warnings are
> a good reminder to the programmer to go and see if there is a real bug
> somewhere and if something really needs to be done with the code (could
> be simply to change the type of a variable to signed that was mistakenly
> declared unsigned, f.e.).
OK, but suppose I looked at it and there's no bug. Leaving the
warning has a cost too: it hides useful warnings (that might be
showing real bugs) in all the clutter.
- R.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists