------- Additional Comments From joseph at codesourcery dot com 2005-06-24 23:04 ------- Subject: Re: New: bogus warning "comparison is always false due to limited range"
On Fri, 24 Jun 2005, eggert at gnu dot org wrote: > Logically, the troublesome warnings fall into the same category as > these unsigned-expressions warnings, so they should be enabled only if > the unsigned-expression warnings are enabled: i.e., only when -Wextra > is specified and we are not in a system header. (a) This is bug 12963. (b) in_system_header checks are generally not needed, warnings in system headers are disabled by default. (c) A separate well-defined option, -Wcomparison-fixed (enabled by -Wextra) for all these warnings, is better than just putting more in -Wextra. Thus, the relevant warnings should have the "(0," changed to "(OPT_Wcomparison_fixed," rather than having explicit checks on the warning flag variable, which helps the aim to remove all warnings with "0" rather than a warning number. In general, passing warning number enumerations to "warning" is always better than explicit flag checks unless the conditions for the warning are expensive to check. (d) Patches changing warnings need testcases (in this case covering all the relevant warnings and testing they no longer appear if no special options are passed but do appear if -Wextra or any new option is passed). (e) The list of warnings in -Wextra is documented, so if a warning is added to that list the documentation of -Wextra needs to be updated (with a reference to any separate option for these warnings). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22178