-
Notifications
You must be signed in to change notification settings - Fork 395
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
Generated methods that return BOOL should return NO instead of 0. #8
Comments
This is a little hard to deal with since we'd need to special-case BOOLs in the machine.m template |
:( That's a pity. Combined with bug #2, I'm starting to have the impression that mogenerator is difficult to expand upon... :( |
It's not difficult to expound on, it just has to deal with asymmetry between Obj-C types and their NSValue/NSNumber method names. I haven't written a mapper since I haven't needed it for myself yet. |
Thanks! Closing. |
AnalysisTool (http://www.karppinen.fi/analysistool/) which in turn uses the llvm static analyzer generates warnings for mogenerated code. ex:
NSNumber *result = [self primitiveIsLeaf];
return result ? [result boolValue] : 0;
}
It warns "coercion from 'int' to 'BOOL' may alter its value". Of course, there isn't really anything wrong with the code above, but the warning could be easily silenced by changing that 0 to a NO. That would fix it because the definition of NO includes a cast to BOOL.
This warning is useful in other situations but all these false positives are generating a lot of noise.
The text was updated successfully, but these errors were encountered: