From 89c831e25ab566756288c45e5505815e9185b276 Mon Sep 17 00:00:00 2001 From: Florian Becker Date: Fri, 1 Oct 2021 02:15:52 +0800 Subject: add missing [[noreturn]] attributes --- include/cppunit/Asserter.h | 40 ++++++++++++++++++++-------------------- src/cppunit/Asserter.cpp | 12 ++++++------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/include/cppunit/Asserter.h b/include/cppunit/Asserter.h index dd39ead..8858688 100644 --- a/include/cppunit/Asserter.h +++ b/include/cppunit/Asserter.h @@ -173,11 +173,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotLess( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "less assertion failed" ); + [[noreturn]] static void CPPUNIT_API failNotLess( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "less assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param expected Text describing the expected value. @@ -187,11 +187,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotGreater( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "greater assertion failed" ); + [[noreturn]] static void CPPUNIT_API failNotGreater( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "greater assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param expected Text describing the expected value. @@ -201,11 +201,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotLessEqual( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "less equal assertion failed" ); + [[noreturn]] static void CPPUNIT_API failNotLessEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "less equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param expected Text describing the expected value. @@ -215,11 +215,11 @@ struct Asserter * what are the differences between the expected and actual value. * \param shortDescription Short description for the failure message. */ - static void CPPUNIT_API failNotGreaterEqual( std::string expected, - std::string actual, - const SourceLine &sourceLine, - const AdditionalMessage &additionalMessage = AdditionalMessage(), - std::string shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location. + [[noreturn]] static void CPPUNIT_API failNotGreaterEqual( std::string expected, + std::string actual, + const SourceLine &sourceLine, + const AdditionalMessage &additionalMessage = AdditionalMessage(), + std::string shortDescription = "greater equal assertion failed" ); /*! \brief Throws an Exception with the specified message and location. * \param shouldFail if \c true then the exception is thrown. Otherwise * nothing happen. diff --git a/src/cppunit/Asserter.cpp b/src/cppunit/Asserter.cpp index 79fcb2e..9e74f1d 100644 --- a/src/cppunit/Asserter.cpp +++ b/src/cppunit/Asserter.cpp @@ -7,7 +7,7 @@ CPPUNIT_NS_BEGIN // coverity[+kill] -void +[[noreturn]] void Asserter::fail( std::string message, const SourceLine &sourceLine ) { @@ -15,7 +15,7 @@ Asserter::fail( std::string message, } // coverity[+kill] -void +[[noreturn]] void Asserter::fail( const Message &message, const SourceLine &sourceLine ) { @@ -124,7 +124,7 @@ Asserter::failNotEqual( std::string expected, } -void +[[noreturn]] void Asserter::failNotLess( std::string expected, std::string actual, const SourceLine &sourceLine, @@ -139,7 +139,7 @@ Asserter::failNotLess( std::string expected, } -void +[[noreturn]] void Asserter::failNotGreater( std::string expected, std::string actual, const SourceLine &sourceLine, @@ -153,7 +153,7 @@ Asserter::failNotGreater( std::string expected, sourceLine ); } -void +[[noreturn]] void Asserter::failNotLessEqual( std::string expected, std::string actual, const SourceLine &sourceLine, @@ -167,7 +167,7 @@ Asserter::failNotLessEqual( std::string expected, sourceLine ); } -void +[[noreturn]] void Asserter::failNotGreaterEqual( std::string expected, std::string actual, const SourceLine &sourceLine, -- cgit v1.2.3