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-07 16:24:05 +0200
committerMartin Hořeňovský2020-05-09 18:00:49 +0200
commitdb32550898ac0b7bdb81228972f6ba58b88ce18d (patch)
treee00421664132373cc9398aebbaf01c8a9f8b8015 /src
parente78b4f6be78912bdc812dba0fbf2166841ffb7be (diff)
downloadcatch3-db32550898ac0b7bdb81228972f6ba58b88ce18d.tar.gz
Remove catch_default_main.hpp
There are two reasons for this: 1) It is highly unlikely that someone has use for this header, which has no customization points and only provides simplest possible main, and cannot link the static library which also provides a default main implementation. 2) It being a header was causing extra complications with the convenience headers, and our checking script. This would either require special handling in the checking script, or would break user's of the main convenience header. All in all, it is simpler and better in the long term to remove it, than to fix its problems.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt3
-rw-r--r--src/catch2/catch_all.hpp1
-rw-r--r--src/catch2/internal/catch_default_main.hpp38
-rw-r--r--src/catch2/internal/catch_main.cpp27
4 files changed, 28 insertions, 41 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c5ac14d1..662e7a2a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -55,7 +55,6 @@ set(INTERNAL_HEADERS
${SOURCES_DIR}/internal/catch_debug_console.hpp
${SOURCES_DIR}/internal/catch_debugger.hpp
${SOURCES_DIR}/internal/catch_decomposer.hpp
- ${SOURCES_DIR}/internal/catch_default_main.hpp
${SOURCES_DIR}/internal/catch_enforce.hpp
${SOURCES_DIR}/internal/catch_enum_values_registry.hpp
${SOURCES_DIR}/internal/catch_errno_guard.hpp
@@ -318,6 +317,8 @@ if (CATCH_BUILD_EXAMPLES OR CATCH_BUILD_EXTRA_TESTS)
${INTERNAL_FILES}
${BENCHMARK_HEADERS}
${BENCHMARK_SOURCES}
+ # Also include main entry point
+ ${SOURCES_DIR}/internal/catch_main.cpp
)
target_include_directories(Catch2_buildall_interface
INTERFACE
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp
index e7d3bfd9..5c6b09d2 100644
--- a/src/catch2/catch_all.hpp
+++ b/src/catch2/catch_all.hpp
@@ -50,7 +50,6 @@
#include <catch2/internal/catch_debug_console.hpp>
#include <catch2/internal/catch_debugger.hpp>
#include <catch2/internal/catch_decomposer.hpp>
-#include <catch2/internal/catch_default_main.hpp>
#include <catch2/internal/catch_enforce.hpp>
#include <catch2/internal/catch_enum_values_registry.hpp>
#include <catch2/internal/catch_errno_guard.hpp>
diff --git a/src/catch2/internal/catch_default_main.hpp b/src/catch2/internal/catch_default_main.hpp
deleted file mode 100644
index 4404f0c8..00000000
--- a/src/catch2/internal/catch_default_main.hpp
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Created by Phil on 20/05/2011.
- * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
- *
- * Distributed under the Boost Software License, Version 1.0. (See accompanying
- * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
- */
-#ifndef TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
-#define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
-
-#include <catch2/catch_session.hpp>
-#include <catch2/internal/catch_compiler_capabilities.hpp>
-#include <catch2/internal/catch_leak_detector.hpp>
-#include <catch2/internal/catch_platform.hpp>
-
-namespace Catch {
- CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
- CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
- LeakDetector leakDetector;
- CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
-}
-
-#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
-// Standard C/C++ Win32 Unicode wmain entry point
-extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
-#else
-// Standard C/C++ main entry point
-int main (int argc, char * argv[]) {
-#endif
-
- // We want to force the linker not to discard the global variable
- // and its constructor, as it (optionally) registers leak detector
- (void)&Catch::leakDetector;
-
- return Catch::Session().run( argc, argv );
-}
-
-#endif // TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED
diff --git a/src/catch2/internal/catch_main.cpp b/src/catch2/internal/catch_main.cpp
index 8eca23c9..4e79d4a7 100644
--- a/src/catch2/internal/catch_main.cpp
+++ b/src/catch2/internal/catch_main.cpp
@@ -3,4 +3,29 @@
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
-#include <catch2/internal/catch_default_main.hpp>
+#include <catch2/catch_session.hpp>
+#include <catch2/internal/catch_compiler_capabilities.hpp>
+#include <catch2/internal/catch_leak_detector.hpp>
+#include <catch2/internal/catch_platform.hpp>
+
+namespace Catch {
+ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
+ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS
+ LeakDetector leakDetector;
+ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION
+}
+
+#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)
+// Standard C/C++ Win32 Unicode wmain entry point
+extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) {
+#else
+// Standard C/C++ main entry point
+int main (int argc, char * argv[]) {
+#endif
+
+ // We want to force the linker not to discard the global variable
+ // and its constructor, as it (optionally) registers leak detector
+ (void)&Catch::leakDetector;
+
+ return Catch::Session().run( argc, argv );
+}