-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings in Xcode 4 #1
Comments
That's what I've been doing, too. I just modified my local version of the code to remove the useless conditions. Seemed easiest. l8r On Jul 2, 2011, at 10:42 AM, adonoho wrote:
|
Fix static analyzer warnings
Gentlefolk,
Xcode 4/clang, as well as Xcode 3.*/gcc, issues 3 warnings when compiling nameprep.c, toxxx.c and util.c.
Here is one of the warnings:
/Users/awd/Projects/Chatter/ChatterX4/../../Libraries/IFUnicodeURL/IFUnicodeURL/IDNSDK/nameprep.c:76:14:{76:7-76:13}{76:16-76:17}: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare,2]
if (offset < 0 || offset > *length) {return;}
~~~~~~ ^ ~
/Users/awd/Projects/Chatter/ChatterX4/../../Libraries/IFUnicodeURL/IFUnicodeURL/IDNSDK/toxxx.c:192:31:{192:10-192:30}{192:33-192:34}: warning: comparison of unsigned expression < 0 is always false [-Wtautological-compare,2]
if ( *(dwzOutputString+i) < 0 || *(dwzOutputString+i) > 0x7F )
~~~~~~~~~~~~~~~~~~~~ ^ ~
There is, of course, a simple fix:
Or we could mask out the sign bit:
For nameprep.c:
For toxxx.c:
util.c is a bit harder:
Before:
After:
Or, even simpler is to turn off tautological warnings ... but I would rather not.
What would be the "right" answer for this project? I've been using the simplest answers, which is to elide the checks on zero, without effect for a long while.
Andrew
The text was updated successfully, but these errors were encountered: