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

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2/internal
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-02-24 23:13:56 +0100
committerMartin Hořeňovský2021-02-24 23:14:18 +0100
commit551946c45bb27b78c85971d32e2a8bccbfa0d3f8 (patch)
treeb4be5f6748261a738c925d17208a2cb226bb6727 /src/catch2/internal
parent653764d53bbc6efadf643625d89cb100a7754483 (diff)
downloadcatch3-551946c45bb27b78c85971d32e2a8bccbfa0d3f8.tar.gz
Split out INTERNAL_CATCH_UNIQUE_NAME into its own header
Also small cleanup of includes of related headers.
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_section.hpp3
-rw-r--r--src/catch2/internal/catch_source_line_info.hpp10
-rw-r--r--src/catch2/internal/catch_template_test_registry.hpp2
-rw-r--r--src/catch2/internal/catch_test_macro_impl.hpp1
-rw-r--r--src/catch2/internal/catch_test_registry.hpp1
-rw-r--r--src/catch2/internal/catch_unique_name.hpp20
6 files changed, 25 insertions, 12 deletions
diff --git a/src/catch2/internal/catch_section.hpp b/src/catch2/internal/catch_section.hpp
index 36d900bb..2e72923c 100644
--- a/src/catch2/internal/catch_section.hpp
+++ b/src/catch2/internal/catch_section.hpp
@@ -13,8 +13,7 @@
#include <catch2/catch_section_info.hpp>
#include <catch2/catch_timer.hpp>
#include <catch2/catch_totals.hpp>
-
-#include <string>
+#include <catch2/internal/catch_unique_name.hpp>
namespace Catch {
diff --git a/src/catch2/internal/catch_source_line_info.hpp b/src/catch2/internal/catch_source_line_info.hpp
index 8aca4867..bd828fad 100644
--- a/src/catch2/internal/catch_source_line_info.hpp
+++ b/src/catch2/internal/catch_source_line_info.hpp
@@ -8,19 +8,9 @@
#ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
#define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
-#include <catch2/internal/catch_config_counter.hpp>
-
#include <cstddef>
#include <iosfwd>
-#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 )
-#ifdef CATCH_CONFIG_COUNTER
-# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
-#else
-# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
-#endif
-
// We need a dummy global operator<< so we can bring it into Catch namespace later
struct Catch_global_namespace_dummy {};
std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);
diff --git a/src/catch2/internal/catch_template_test_registry.hpp b/src/catch2/internal/catch_template_test_registry.hpp
index 3617109b..83c47d7d 100644
--- a/src/catch2/internal/catch_template_test_registry.hpp
+++ b/src/catch2/internal/catch_template_test_registry.hpp
@@ -12,6 +12,8 @@
#include <catch2/internal/catch_compiler_capabilities.hpp>
#include <catch2/internal/catch_preprocessor.hpp>
#include <catch2/internal/catch_meta.hpp>
+#include <catch2/internal/catch_unique_name.hpp>
+
// GCC 5 and older do not properly handle disabling unused-variable warning
// with a _Pragma. This means that we have to leak the suppression to the
diff --git a/src/catch2/internal/catch_test_macro_impl.hpp b/src/catch2/internal/catch_test_macro_impl.hpp
index 9ceb03ab..357e114d 100644
--- a/src/catch2/internal/catch_test_macro_impl.hpp
+++ b/src/catch2/internal/catch_test_macro_impl.hpp
@@ -11,6 +11,7 @@
#include <catch2/internal/catch_assertion_handler.hpp>
#include <catch2/interfaces/catch_interfaces_capture.hpp>
#include <catch2/internal/catch_stringref.hpp>
+#include <catch2/internal/catch_source_line_info.hpp>
// We need this suppression to leak, because it took until GCC 9
// for the front end to handle local suppression via _Pragma properly
diff --git a/src/catch2/internal/catch_test_registry.hpp b/src/catch2/internal/catch_test_registry.hpp
index 0f5ec488..9e8b5b6e 100644
--- a/src/catch2/internal/catch_test_registry.hpp
+++ b/src/catch2/internal/catch_test_registry.hpp
@@ -13,6 +13,7 @@
#include <catch2/interfaces/catch_interfaces_testcase.hpp>
#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_unique_ptr.hpp>
+#include <catch2/internal/catch_unique_name.hpp>
// GCC 5 and older do not properly handle disabling unused-variable warning
// with a _Pragma. This means that we have to leak the suppression to the
diff --git a/src/catch2/internal/catch_unique_name.hpp b/src/catch2/internal/catch_unique_name.hpp
new file mode 100644
index 00000000..31ab9126
--- /dev/null
+++ b/src/catch2/internal/catch_unique_name.hpp
@@ -0,0 +1,20 @@
+
+// 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_UNIQUE_NAME_HPP_INCLUDED
+#define CATCH_UNIQUE_NAME_HPP_INCLUDED
+
+#include <catch2/internal/catch_config_counter.hpp>
+#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 )
+#ifdef CATCH_CONFIG_COUNTER
+# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )
+#else
+# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )
+#endif
+
+#endif // CATCH_UNIQUE_NAME_HPP_INCLUDED