clang-tidy: How to suppress warnings?

后端 未结 4 1818
抹茶落季
抹茶落季 2020-12-30 04:02

I recently started experimenting with the clang-tidy tool of llvm. Now I am trying to suppress false warnings from third party library code. For this I want to

4条回答
  •  感情败类
    2020-12-30 04:30

    I solved the problem by adding // NOLINT to line 1790 of gmock-spec-builders.h

    Here is the diff:

    --- gmock-spec-builders.orig.h  2016-09-17 09:46:48.527313088 +0200
    +++ gmock-spec-builders.h       2016-09-17 09:46:58.958353697 +0200
    @@ -1787,7 +1787,7 @@
     #define ON_CALL(obj, call) GMOCK_ON_CALL_IMPL_(obj, call)
    
     #define GMOCK_EXPECT_CALL_IMPL_(obj, call) \
    -    ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call)
    +    ((obj).gmock_##call).InternalExpectedAt(__FILE__, __LINE__, #obj, #call) // NOLINT
     #define EXPECT_CALL(obj, call) GMOCK_EXPECT_CALL_IMPL_(obj, call)
    
     #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
    

    It would be nice to either upstream this patch (I see other NOLINT in the code) or post a bug report with the clang-tidy folks.

提交回复
热议问题