Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-05-10 20:02:29 +0200
committerMartin Hořeňovský2020-05-10 20:21:04 +0200
commitf64487bf7074eeb5247479f3896807d38059fc9a (patch)
treecc29428059d0dea458a9d976f9d53b56de62cabd /src
parent27f1756d8e7d2a59832cac83f3219c9ebd286abf (diff)
downloadcatch3-f64487bf7074eeb5247479f3896807d38059fc9a.tar.gz
Move LazyExpr's and MessageInfo's implementation to the combined TU
Some of the implementations were inlined instead.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/catch2/internal/catch_combined_tu.cpp51
-rw-r--r--src/catch2/internal/catch_decomposer.hpp5
-rw-r--r--src/catch2/internal/catch_lazy_expr.cpp30
-rw-r--r--src/catch2/internal/catch_message_info.cpp26
-rw-r--r--src/catch2/internal/catch_message_info.hpp8
6 files changed, 61 insertions, 61 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a8d7799d..dac58fab 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -148,13 +148,11 @@ set(IMPL_SOURCES
${SOURCES_DIR}/generators/internal/catch_generators_combined_tu.cpp
${SOURCES_DIR}/interfaces/catch_interfaces_combined_tu.cpp
${SOURCES_DIR}/interfaces/catch_interfaces_reporter.cpp
- ${SOURCES_DIR}/internal/catch_lazy_expr.cpp
${SOURCES_DIR}/internal/catch_list.cpp
${SOURCES_DIR}/matchers/catch_matchers_floating.cpp
${SOURCES_DIR}/matchers/catch_matchers_string.cpp
${SOURCES_DIR}/matchers/catch_matchers_templated.cpp
${SOURCES_DIR}/catch_message.cpp
- ${SOURCES_DIR}/internal/catch_message_info.cpp
${SOURCES_DIR}/internal/catch_output_redirect.cpp
${SOURCES_DIR}/catch_registry_hub.cpp
${SOURCES_DIR}/internal/catch_combined_tu.cpp
diff --git a/src/catch2/internal/catch_combined_tu.cpp b/src/catch2/internal/catch_combined_tu.cpp
index c6819362..fcb05093 100644
--- a/src/catch2/internal/catch_combined_tu.cpp
+++ b/src/catch2/internal/catch_combined_tu.cpp
@@ -171,3 +171,54 @@ namespace Catch {
Catch::LeakDetector::~LeakDetector() {
Catch::cleanUp();
}
+
+
+/////////////////////////////////////////////
+// vvv formerly catch_message_info.cpp vvv //
+/////////////////////////////////////////////
+
+#include <catch2/internal/catch_message_info.hpp>
+
+namespace Catch {
+
+ MessageInfo::MessageInfo( StringRef const& _macroName,
+ SourceLineInfo const& _lineInfo,
+ ResultWas::OfType _type )
+ : macroName( _macroName ),
+ lineInfo( _lineInfo ),
+ type( _type ),
+ sequence( ++globalCount )
+ {}
+
+ // This may need protecting if threading support is added
+ unsigned int MessageInfo::globalCount = 0;
+
+} // end namespace Catch
+
+
+
+
+//////////////////////////////////////////
+// vvv formerly catch_lazy_expr.cpp vvv //
+//////////////////////////////////////////
+#include <catch2/internal/catch_lazy_expr.hpp>
+#include <catch2/internal/catch_decomposer.hpp>
+
+namespace Catch {
+
+ auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
+ if (lazyExpr.m_isNegated)
+ os << "!";
+
+ if (lazyExpr) {
+ if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
+ os << "(" << *lazyExpr.m_transientExpression << ")";
+ else
+ os << *lazyExpr.m_transientExpression;
+ } else {
+ os << "{** error - unchecked empty expression requested **}";
+ }
+ return os;
+ }
+
+} // namespace Catch
diff --git a/src/catch2/internal/catch_decomposer.hpp b/src/catch2/internal/catch_decomposer.hpp
index 4c90091c..dc1c2d6b 100644
--- a/src/catch2/internal/catch_decomposer.hpp
+++ b/src/catch2/internal/catch_decomposer.hpp
@@ -49,7 +49,10 @@ namespace Catch {
bool m_isBinaryExpression;
bool m_result;
-
+ friend std::ostream& operator<<(std::ostream& out, ITransientExpression const& expr) {
+ expr.streamReconstructedExpression(out);
+ return out;
+ }
};
void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );
diff --git a/src/catch2/internal/catch_lazy_expr.cpp b/src/catch2/internal/catch_lazy_expr.cpp
deleted file mode 100644
index 21a33cdc..00000000
--- a/src/catch2/internal/catch_lazy_expr.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <catch2/internal/catch_lazy_expr.hpp>
-
-#include <catch2/internal/catch_decomposer.hpp>
-
-
-namespace Catch {
-
- namespace {
- auto operator <<(std::ostream& os, ITransientExpression const& expr) -> std::ostream& {
- expr.streamReconstructedExpression(os);
- return os;
- }
- }
-
- auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {
- if (lazyExpr.m_isNegated)
- os << "!";
-
- if (lazyExpr) {
- if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())
- os << "(" << *lazyExpr.m_transientExpression << ")";
- else
- os << *lazyExpr.m_transientExpression;
- } else {
- os << "{** error - unchecked empty expression requested **}";
- }
- return os;
- }
-
-} // namespace Catch
diff --git a/src/catch2/internal/catch_message_info.cpp b/src/catch2/internal/catch_message_info.cpp
deleted file mode 100644
index 65d990ad..00000000
--- a/src/catch2/internal/catch_message_info.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-#include <catch2/internal/catch_message_info.hpp>
-
-namespace Catch {
-
- MessageInfo::MessageInfo( StringRef const& _macroName,
- SourceLineInfo const& _lineInfo,
- ResultWas::OfType _type )
- : macroName( _macroName ),
- lineInfo( _lineInfo ),
- type( _type ),
- sequence( ++globalCount )
- {}
-
- bool MessageInfo::operator==( MessageInfo const& other ) const {
- return sequence == other.sequence;
- }
-
- bool MessageInfo::operator<( MessageInfo const& other ) const {
- return sequence < other.sequence;
- }
-
- // This may need protecting if threading support is added
- unsigned int MessageInfo::globalCount = 0;
-
-} // end namespace Catch
diff --git a/src/catch2/internal/catch_message_info.hpp b/src/catch2/internal/catch_message_info.hpp
index b1af4565..8845dcfd 100644
--- a/src/catch2/internal/catch_message_info.hpp
+++ b/src/catch2/internal/catch_message_info.hpp
@@ -20,8 +20,12 @@ namespace Catch {
ResultWas::OfType type;
unsigned int sequence;
- bool operator == ( MessageInfo const& other ) const;
- bool operator < ( MessageInfo const& other ) const;
+ bool operator == (MessageInfo const& other) const {
+ return sequence == other.sequence;
+ }
+ bool operator < (MessageInfo const& other) const {
+ return sequence < other.sequence;
+ }
private:
static unsigned int globalCount;
};