[Swan] useless gcc "warning: comparison is always false due to limited range of data type [-Wtype-limits]"

D. Hugh Redelmeier hugh at mimosa.com
Tue Sep 24 21:17:03 EEST 2013


There are a few lines in linux/net/ipsec/pfkey_v2_build.c that provoke gcc 
into this warning.

The check provoking the warning is defensive: it protects against errors.  
I'd rather not remove the check.

The message is often useful: it diagnoses tests that are not needed 
because the result is forced by the range of values that can be 
represented by one of the operands.  I'd rather not suppress the warning 
in general.

How does this get resolved?  There is a long-standing GCC Bugzilla item 
about this <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12963>.

I guess that the best approach is the flag -Wno-type-limits for this file. 
Too bad you cannot do this for each problemetic expression.


More information about the Swan mailing list