I use an open source library VTK which has multiline macros (in vtkSetGet.h) containing static_cast statements that our clang-tidy configuration warns about. I tried to suppress these warnings by surrounding them with NOLINT comments like this:
return static_cast<thisClass*>(o); \
But this doesn’t seem to work: I still see the calls being flagged.
Can someone advise me on how to suppress these warnings?
You should not need to touch any of the VTK code. Instead, make sure that it is included as a “system library”, i.e. that the include directory is of the form
Can I do that in a .clang-tidy file too? What would be the syntax for that?
You can try to play with the
HeaderFilterRegex option as well, but I haven’t found this very useful in practice. My solution above has to do with your build system.
Anyhow, if you do want to touch VTK code, it should be something like:
#define MULTILINE_MACRO \
I’ve tried this and also around the entire contents of the header file, but nothing seems to work …
Strange, this works:
#define MY_MACRO \
struct X \