-
Notifications
You must be signed in to change notification settings - Fork 494
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
False positives due to macro expansion #378
Comments
This sounds like a good addition to oclint and would also solve things like #280. Not sure if we can get the necessary information from clang but will see what I can do. |
@UnrealQuester I have been wondering if a hack will do the trick. Even though at the time we have the AST layer from clang compiler, the marcos have been expanded already. However, I was thinking maybe we can take a look at the source file location of the problematic AST node to guess if it is from the same file or from a source location other than the current file. For the latter case, we would ignore them. |
The right way to do this would be using |
Thanks for the links, @daniel-beard! Can we also find out if the macro definition is in a system header? We might want to warn for macros that the user has control over and ignore macros in third party libraries that the user likely can do nothing about. |
I would appreciate a solution as well. For the project I'm working on, I have macros defined that point to code inside the CocoaPods, that should be excluded by using the -e flag. This makes that there are lots of warnings for pods' code. |
+1 |
Renamed this issue to cover a broader problem due to macro expansion. Thanks @alistra for pointing it out. I am copying over his original comment to here:
|
gcc
,clang
, etc. use-isystem
to add an include path and to mark that no warnings should be generated for code within them. This also includes when macros are defined in system headers:In a large project I'm checking, use of Boost constructs such as the
BOOST_FOREACH
andBOOST_ASSERT
macros generate a lot of bogus warnings.The text was updated successfully, but these errors were encountered: