diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c6aaba3..4aaea817 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -109,6 +109,7 @@ set(INTERNAL_HEADERS ${SOURCES_DIR}/internal/catch_singletons.hpp ${SOURCES_DIR}/internal/catch_startup_exception_registry.hpp ${SOURCES_DIR}/internal/catch_stream.hpp + ${SOURCES_DIR}/internal/catch_stream_end_stop.hpp ${SOURCES_DIR}/internal/catch_string_manip.hpp ${SOURCES_DIR}/internal/catch_stringref.hpp ${SOURCES_DIR}/catch_tag_alias.hpp diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp index 6e93d54c..ed035223 100644 --- a/src/catch2/catch_all.hpp +++ b/src/catch2/catch_all.hpp @@ -83,6 +83,7 @@ #include #include #include +#include #include #include #include diff --git a/src/catch2/catch_message.hpp b/src/catch2/catch_message.hpp index 21e666bc..db60b6bf 100644 --- a/src/catch2/catch_message.hpp +++ b/src/catch2/catch_message.hpp @@ -9,8 +9,8 @@ #define CATCH_MESSAGE_HPP_INCLUDED #include -#include #include +#include #include #include #include @@ -20,6 +20,8 @@ namespace Catch { + struct SourceLineInfo; + struct MessageStream { template diff --git a/src/catch2/internal/catch_common.hpp b/src/catch2/internal/catch_common.hpp index 8e13a90e..82360594 100644 --- a/src/catch2/internal/catch_common.hpp +++ b/src/catch2/internal/catch_common.hpp @@ -9,7 +9,6 @@ #define CATCH_COMMON_HPP_INCLUDED #include -#include #define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line #define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) @@ -49,21 +48,6 @@ namespace Catch { // This is necessary because the overload of operator<< above makes // lookup stop at namespace Catch using ::operator<<; - - // Use this in variadic streaming macros to allow - // >> +StreamEndStop - // as well as - // >> stuff +StreamEndStop - struct StreamEndStop { - StringRef operator+() const { - return StringRef(); - } - - template - friend T const& operator + ( T const& value, StreamEndStop ) { - return value; - } - }; } #define CATCH_INTERNAL_LINEINFO \ diff --git a/src/catch2/internal/catch_stream_end_stop.hpp b/src/catch2/internal/catch_stream_end_stop.hpp new file mode 100644 index 00000000..452ca1e9 --- /dev/null +++ b/src/catch2/internal/catch_stream_end_stop.hpp @@ -0,0 +1,30 @@ + +// Copyright Catch2 Authors +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// https://www.boost.org/LICENSE_1_0.txt) + +// SPDX-License-Identifier: BSL-1.0 +#ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED +#define CATCH_STREAM_END_STOP_HPP_INCLUDED + +#include + +namespace Catch { + + // Use this in variadic streaming macros to allow + // << +StreamEndStop + // as well as + // << stuff +StreamEndStop + struct StreamEndStop { + StringRef operator+() const { return StringRef(); } + + template + friend T const& operator+( T const& value, StreamEndStop ) { + return value; + } + }; + +} // namespace Catch + +#endif // CATCH_STREAM_END_STOP_HPP_INCLUDED