diff options
| author | Martin Hořeňovský | 2017-11-21 21:39:40 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2017-11-22 16:03:45 +0100 |
| commit | 401ad7a18941fb3744533a315a8a9500a7f573c9 (patch) | |
| tree | 6ff9a2962de8bb4a7f6f598b9cd951d13be1e402 /include | |
| parent | 63c097a07775f939b5b77c88dd61fe933f4d7050 (diff) | |
| download | catch3-401ad7a18941fb3744533a315a8a9500a7f573c9.tar.gz | |
Remove isTrue, alwaysTrue, alwaysFalse
isTrue and alwaysFalse were replaced by (void)0, 0 inspired by doctest
alwaysTrue was replaced by warning suppression
Diffstat (limited to 'include')
| -rw-r--r-- | include/internal/catch_capture.hpp | 12 | ||||
| -rw-r--r-- | include/internal/catch_capture_matchers.h | 4 | ||||
| -rw-r--r-- | include/internal/catch_common.cpp | 3 | ||||
| -rw-r--r-- | include/internal/catch_common.h | 5 | ||||
| -rw-r--r-- | include/internal/catch_debugger.h | 2 |
5 files changed, 9 insertions, 17 deletions
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 595336d4..e0613487 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -63,7 +63,7 @@ CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::isTrue(false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look + } while( (void)0, 0 && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. /////////////////////////////////////////////////////////////////////////////// @@ -88,7 +88,7 @@ catchAssertionHandler.useActiveException(); \ } \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::alwaysFalse() ) + } while( false ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \ @@ -105,7 +105,7 @@ else \ catchAssertionHandler.handle( Catch::ResultWas::Ok ); \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::alwaysFalse() ) + } while( false ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \ @@ -125,7 +125,7 @@ else \ catchAssertionHandler.handle( Catch::ResultWas::Ok ); \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::alwaysFalse() ) + } while( false ) /////////////////////////////////////////////////////////////////////////////// @@ -134,7 +134,7 @@ Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \ catchAssertionHandler.handle( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::alwaysFalse() ) + } while( false ) /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_INFO( macroName, log ) \ @@ -156,7 +156,7 @@ else \ catchAssertionHandler.handle( Catch::ResultWas::Ok ); \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::alwaysFalse() ) + } while( false ) #endif // CATCH_CONFIG_DISABLE diff --git a/include/internal/catch_capture_matchers.h b/include/internal/catch_capture_matchers.h index 77366f33..cce61747 100644 --- a/include/internal/catch_capture_matchers.h +++ b/include/internal/catch_capture_matchers.h @@ -63,7 +63,7 @@ namespace Catch { catchAssertionHandler.handle( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \ } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::alwaysFalse() ) + } while( false ) /////////////////////////////////////////////////////////////////////////////// @@ -84,6 +84,6 @@ namespace Catch { else \ catchAssertionHandler.handle( Catch::ResultWas::Ok ); \ INTERNAL_CATCH_REACT( catchAssertionHandler ) \ - } while( Catch::alwaysFalse() ) + } while( false ) #endif // TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED diff --git a/include/internal/catch_common.cpp b/include/internal/catch_common.cpp index 470b7ea9..e96c3be2 100644 --- a/include/internal/catch_common.cpp +++ b/include/internal/catch_common.cpp @@ -38,9 +38,6 @@ namespace Catch { return os; } - bool alwaysTrue() { return true; } - bool alwaysFalse() { return false; } - std::string StreamEndStop::operator+() const { return std::string(); } diff --git a/include/internal/catch_common.h b/include/internal/catch_common.h index 026ac2bb..c1a771c1 100644 --- a/include/internal/catch_common.h +++ b/include/internal/catch_common.h @@ -60,11 +60,6 @@ namespace Catch { std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); - // This is just here to avoid compiler warnings with macro constants and boolean literals - inline bool isTrue( bool value ){ return value; } - bool alwaysTrue(); - bool alwaysFalse(); - // Use this in variadic streaming macros to allow // >> +StreamEndStop // as well as diff --git a/include/internal/catch_debugger.h b/include/internal/catch_debugger.h index f842ff5b..6ca6a539 100644 --- a/include/internal/catch_debugger.h +++ b/include/internal/catch_debugger.h @@ -40,7 +40,7 @@ namespace Catch { #ifdef CATCH_TRAP #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } #else - #define CATCH_BREAK_INTO_DEBUGGER() Catch::alwaysTrue(); + #define CATCH_BREAK_INTO_DEBUGGER() (void)0, 0 #endif #endif // TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED |