Skip to content

False positives due to macro expansion #378

@abigailbunyan

Description

@abigailbunyan

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:

$ clang++ test.cpp -I include/ -Wold-style-cast
test.cpp:3:21: warning: use of old-style cast [-Wold-style-cast]
int main() { return FOO(0); }
                    ^~~~~~
include/test.h:1:17: note: expanded from macro 'FOO'
#define FOO(x) ((int)(x))
                ^    ~~~
$ clang++ test.cpp -isystem include/ -Wold-style-cast
$

In a large project I'm checking, use of Boost constructs such as the BOOST_FOREACH and BOOST_ASSERT macros generate a lot of bogus warnings.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions