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ý2020-12-29 11:07:45 +0100
committerMartin Hořeňovský2020-12-29 11:07:45 +0100
commit4e8832fc882f231c5850836bfc87297ff27f7827 (patch)
treea1f229704a2a4db022b389b4ba35b2af78102079 /src/catch2/internal
parentbdd1e5c61345c3190d74778549c0999b4e294f2b (diff)
downloadcatch3-4e8832fc882f231c5850836bfc87297ff27f7827.tar.gz
Split CATCH_CONFIG_COUNTER into its own header
Part of #2041
Diffstat (limited to 'src/catch2/internal')
-rw-r--r--src/catch2/internal/catch_compiler_capabilities.hpp16
-rw-r--r--src/catch2/internal/catch_config_counter.hpp32
-rw-r--r--src/catch2/internal/catch_source_line_info.hpp2
3 files changed, 33 insertions, 17 deletions
diff --git a/src/catch2/internal/catch_compiler_capabilities.hpp b/src/catch2/internal/catch_compiler_capabilities.hpp
index b98921ae..3c24cf2b 100644
--- a/src/catch2/internal/catch_compiler_capabilities.hpp
+++ b/src/catch2/internal/catch_compiler_capabilities.hpp
@@ -11,7 +11,6 @@
// Detect a number of compiler features - by compiler
// The following features are defined:
//
-// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported?
// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?
// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?
// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled?
@@ -195,18 +194,6 @@
////////////////////////////////////////////////////////////////////////////////
-// Use of __COUNTER__ is suppressed during code analysis in
-// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly
-// handled by it.
-// Otherwise all supported compilers support COUNTER macro,
-// but user still might want to turn it off
-#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
- #define CATCH_INTERNAL_CONFIG_COUNTER
-#endif
-
-
-////////////////////////////////////////////////////////////////////////////////
-
// RTX is a special version of Windows that is real time.
// This means that it is detected as Windows, but does not provide
// the same set of capabilities as real Windows does.
@@ -258,9 +245,6 @@
#endif // defined(__has_include)
-#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)
-# define CATCH_CONFIG_COUNTER
-#endif
#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)
# define CATCH_CONFIG_WINDOWS_SEH
#endif
diff --git a/src/catch2/internal/catch_config_counter.hpp b/src/catch2/internal/catch_config_counter.hpp
new file mode 100644
index 00000000..febb3eee
--- /dev/null
+++ b/src/catch2/internal/catch_config_counter.hpp
@@ -0,0 +1,32 @@
+
+// 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
+
+/** \file
+ * Wrapper for the CONFIG configuration option
+ *
+ * When generating internal unique names, there are two options. Either
+ * we mix in the current line number, or mix in an incrementing number.
+ * We prefer the latter, using `__COUNTER__`, but users might want to
+ * use the former.
+ */
+
+#ifndef CATCH_CONFIG_COUNTER_HPP_INCLUDED
+#define CATCH_CONFIG_COUNTER_HPP_INCLUDED
+
+#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )
+ #define CATCH_INTERNAL_CONFIG_COUNTER
+#endif
+
+#if defined( CATCH_INTERNAL_CONFIG_COUNTER ) && \
+ !defined( CATCH_CONFIG_NO_COUNTER ) && \
+ !defined( CATCH_CONFIG_COUNTER )
+# define CATCH_CONFIG_COUNTER
+#endif
+
+
+#endif // CATCH_CONFIG_COUNTER_HPP_INCLUDED
diff --git a/src/catch2/internal/catch_source_line_info.hpp b/src/catch2/internal/catch_source_line_info.hpp
index 4133011f..8aca4867 100644
--- a/src/catch2/internal/catch_source_line_info.hpp
+++ b/src/catch2/internal/catch_source_line_info.hpp
@@ -8,7 +8,7 @@
#ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
#define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED
-#include <catch2/internal/catch_compiler_capabilities.hpp>
+#include <catch2/internal/catch_config_counter.hpp>
#include <cstddef>
#include <iosfwd>