From 4c5650f68866e3c2e60361d5c4c95c6f335fb64b Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Tue, 7 Dec 2021 15:08:42 -0800 Subject: [PATCH] Add NOLINT to address modernize-use-trailing-return-type in TEST_F uses Example command: ``` clang_tidy '--config={Checks: "modernize-use-trailing-return-type"}' googletest-death-test-test.cc ``` Example error: ``` warning: use a trailing return type for this function [modernize-use-trailing-return-type] TEST(NotADeathTest, Test) { ^ ``` PiperOrigin-RevId: 414836261 Change-Id: I5f758423667559abfbf313190543666bc4ce0e6e --- googletest/include/gtest/internal/gtest-port.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index cc6fa6b3..619498fa 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -689,25 +689,29 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // A macro to disallow copy operator= // This should be used in the private: declarations for a class. +// NOLINT is for modernize-use-trailing-return-type in macro uses. #define GTEST_DISALLOW_ASSIGN_(type) \ - type& operator=(type const &) = delete + type& operator=(type const&) = delete /* NOLINT */ // A macro to disallow copy constructor and operator= // This should be used in the private: declarations for a class. +// NOLINT is for modernize-use-trailing-return-type in macro uses. #define GTEST_DISALLOW_COPY_AND_ASSIGN_(type) \ type(type const&) = delete; \ - type& operator=(type const&) = delete + type& operator=(type const&) = delete /* NOLINT */ // A macro to disallow move operator= // This should be used in the private: declarations for a class. +// NOLINT is for modernize-use-trailing-return-type in macro uses. #define GTEST_DISALLOW_MOVE_ASSIGN_(type) \ - type& operator=(type &&) noexcept = delete + type& operator=(type&&) noexcept = delete /* NOLINT */ // A macro to disallow move constructor and operator= // This should be used in the private: declarations for a class. +// NOLINT is for modernize-use-trailing-return-type in macro uses. #define GTEST_DISALLOW_MOVE_AND_ASSIGN_(type) \ type(type&&) noexcept = delete; \ - type& operator=(type&&) noexcept = delete + type& operator=(type&&) noexcept = delete /* NOLINT */ // Tell the compiler to warn about unused return values for functions declared // with this macro. The macro should be used on function declarations