diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7a4bebb8..20d15d23 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,7 +60,6 @@ set(INTERNAL_HEADERS ${SOURCES_DIR}/catch_generators.hpp ${SOURCES_DIR}/catch_generators_generic.hpp ${SOURCES_DIR}/catch_generators_specific.hpp - ${SOURCES_DIR}/catch_impl.hpp ${SOURCES_DIR}/catch_interfaces_capture.h ${SOURCES_DIR}/catch_interfaces_config.h ${SOURCES_DIR}/catch_interfaces_enum_values_registry.h diff --git a/src/catch2/catch_default_main.hpp b/src/catch2/catch_default_main.hpp index a61ad98d..4f769695 100644 --- a/src/catch2/catch_default_main.hpp +++ b/src/catch2/catch_default_main.hpp @@ -9,8 +9,17 @@ #define TWOBLUECUBES_CATCH_DEFAULT_MAIN_HPP_INCLUDED #include +#include +#include #include +namespace Catch { + CATCH_INTERNAL_START_WARNINGS_SUPPRESSION + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS + LeakDetector leakDetector; + CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION +} + #ifndef __OBJC__ #if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) @@ -21,6 +30,10 @@ extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { 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 ); } diff --git a/src/catch2/catch_impl.hpp b/src/catch2/catch_impl.hpp deleted file mode 100644 index 681110dc..00000000 --- a/src/catch2/catch_impl.hpp +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Created by Phil on 5/8/2012. - * Copyright 2012 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_IMPL_HPP_INCLUDED -#define TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wweak-vtables" -#endif - -// Keep these here for external reporters -#include -#include - -#include - -// Cpp files will be included in the single-header file here -// ~*~* CATCH_CPP_STITCH_PLACE *~*~ - -namespace Catch { - LeakDetector leakDetector; -} - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -#endif // TWOBLUECUBES_CATCH_IMPL_HPP_INCLUDED