From 165647abbcbf27dcdae074bdb9d5fe2eaffceb67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Fri, 17 Jun 2022 18:23:06 +0200 Subject: [PATCH] Change provideBazelReporterOutput to local linkage --- src/catch2/catch_config.cpp | 45 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/src/catch2/catch_config.cpp b/src/catch2/catch_config.cpp index a0f1638e..4465831d 100644 --- a/src/catch2/catch_config.cpp +++ b/src/catch2/catch_config.cpp @@ -13,10 +13,29 @@ #include #include -namespace Catch { +namespace { + bool provideBazelReporterOutput() { +#ifdef CATCH_CONFIG_BAZEL_SUPPORT + return true; +#else - // Requires declaration for -Wmissing-declarations. - bool provideBazelReporterOutput(); +# if defined( _MSC_VER ) + // On Windows getenv throws a warning as there is no input validation, + // since the switch is hardcoded, this should not be an issue. +# pragma warning( push ) +# pragma warning( disable : 4996 ) +# endif + + return std::getenv( "BAZEL_TEST" ) != nullptr; + +# if defined( _MSC_VER ) +# pragma warning( pop ) +# endif +#endif + } +} + +namespace Catch { bool operator==( ProcessedReporterSpec const& lhs, ProcessedReporterSpec const& rhs ) { @@ -116,26 +135,6 @@ namespace Catch { bool Config::listReporters() const { return m_data.listReporters; } bool Config::listListeners() const { return m_data.listListeners; } - bool provideBazelReporterOutput() { -#ifdef CATCH_CONFIG_BAZEL_SUPPORT - return true; -#else - -# if defined( _MSC_VER ) - // On Windows getenv throws a warning as there is no input validation, - // since the switch is hardcoded, this should not be an issue. -# pragma warning( push ) -# pragma warning( disable : 4996 ) -# endif - - return std::getenv("BAZEL_TEST") != nullptr; - -# if defined( _MSC_VER ) -# pragma warning( pop ) -# endif -#endif - } - std::vector const& Config::getTestsOrTags() const { return m_data.testsOrTags; } std::vector const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }