mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-16 18:52:25 +01:00
Add MSVC compiler flag. (see #2094)
This commit is contained in:
parent
c665fd7f50
commit
e3aaa40fe7
@ -10,11 +10,12 @@
|
|||||||
#ifndef CATCH_OPTIMIZER_HPP_INCLUDED
|
#ifndef CATCH_OPTIMIZER_HPP_INCLUDED
|
||||||
#define CATCH_OPTIMIZER_HPP_INCLUDED
|
#define CATCH_OPTIMIZER_HPP_INCLUDED
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
|
|
||||||
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
# include <atomic> // atomic_thread_fence
|
# include <atomic> // atomic_thread_fence
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
|
||||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||||
|
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
@ -33,7 +34,7 @@ namespace Catch {
|
|||||||
namespace Detail {
|
namespace Detail {
|
||||||
inline void optimizer_barrier() { keep_memory(); }
|
inline void optimizer_barrier() { keep_memory(); }
|
||||||
} // namespace Detail
|
} // namespace Detail
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(CATCH_COMPILER_MSC)
|
||||||
|
|
||||||
#pragma optimize("", off)
|
#pragma optimize("", off)
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
#include <catch2/catch_config.hpp>
|
#include <catch2/catch_config.hpp>
|
||||||
|
|
||||||
#include <catch2/catch_user_config.hpp>
|
#include <catch2/catch_user_config.hpp>
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_enforce.hpp>
|
#include <catch2/internal/catch_enforce.hpp>
|
||||||
#include <catch2/internal/catch_stream.hpp>
|
#include <catch2/internal/catch_stream.hpp>
|
||||||
#include <catch2/internal/catch_stringref.hpp>
|
#include <catch2/internal/catch_stringref.hpp>
|
||||||
@ -68,14 +70,14 @@ namespace Catch {
|
|||||||
// during test, Bazel will not generate a default XML output.
|
// during test, Bazel will not generate a default XML output.
|
||||||
// This allows the XML output file to contain higher level of detail
|
// This allows the XML output file to contain higher level of detail
|
||||||
// than what is possible otherwise.
|
// than what is possible otherwise.
|
||||||
# if defined( _MSC_VER )
|
# if defined( CATCH_COMPILER_MSC )
|
||||||
// On Windows getenv throws a warning as there is no input validation,
|
// On Windows getenv throws a warning as there is no input validation,
|
||||||
// since the key is hardcoded, this should not be an issue.
|
// since the key is hardcoded, this should not be an issue.
|
||||||
# pragma warning( push )
|
# pragma warning( push )
|
||||||
# pragma warning( disable : 4996 )
|
# pragma warning( disable : 4996 )
|
||||||
# endif
|
# endif
|
||||||
const auto bazelOutputFilePtr = std::getenv( "XML_OUTPUT_FILE" );
|
const auto bazelOutputFilePtr = std::getenv( "XML_OUTPUT_FILE" );
|
||||||
# if defined( _MSC_VER )
|
# if defined( CATCH_COMPILER_MSC )
|
||||||
# pragma warning( pop )
|
# pragma warning( pop )
|
||||||
# endif
|
# endif
|
||||||
if ( bazelOutputFilePtr != nullptr ) {
|
if ( bazelOutputFilePtr != nullptr ) {
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include <string_view>
|
#include <string_view>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
|
#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless
|
||||||
#endif
|
#endif
|
||||||
@ -625,7 +625,7 @@ struct ratio_string<std::milli> {
|
|||||||
static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {
|
static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {
|
||||||
auto converted = std::chrono::system_clock::to_time_t(time_point);
|
auto converted = std::chrono::system_clock::to_time_t(time_point);
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
std::tm timeInfo = {};
|
std::tm timeInfo = {};
|
||||||
gmtime_s(&timeInfo, &converted);
|
gmtime_s(&timeInfo, &converted);
|
||||||
#else
|
#else
|
||||||
@ -636,7 +636,7 @@ struct ratio_string<std::milli> {
|
|||||||
char timeStamp[timeStampSize];
|
char timeStamp[timeStampSize];
|
||||||
const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
|
const char * const fmt = "%Y-%m-%dT%H:%M:%SZ";
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
|
std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);
|
||||||
#else
|
#else
|
||||||
std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
|
std::strftime(timeStamp, timeStampSize, fmt, timeInfo);
|
||||||
@ -660,7 +660,7 @@ namespace Catch { \
|
|||||||
|
|
||||||
#define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )
|
#define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -32,10 +32,14 @@
|
|||||||
#define CATCH_COMPILER_GCC
|
#define CATCH_COMPILER_GCC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__clang__) && !defined(_MSC_VER)
|
#if defined(__clang__)
|
||||||
#define CATCH_COMPILER_CLANG
|
#define CATCH_COMPILER_CLANG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
#define CATCH_COMPILER_MSC
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
|
# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
|
||||||
@ -164,7 +168,7 @@
|
|||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Visual C++
|
// Visual C++
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
|
|
||||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
||||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
||||||
|
@ -17,7 +17,9 @@
|
|||||||
#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
|
#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
|
||||||
#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
|
#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
|
|
||||||
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
|
# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
|
||||||
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
|
||||||
# endif
|
# endif
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
// for C++14 or C++ libraries with incomplete support.
|
// for C++14 or C++ libraries with incomplete support.
|
||||||
// We also have to handle that MSVC std lib will happily provide these
|
// We also have to handle that MSVC std lib will happily provide these
|
||||||
// under older standards.
|
// under older standards.
|
||||||
#if defined(CATCH_CPP17_OR_GREATER) || defined(_MSC_VER)
|
#if defined(CATCH_CPP17_OR_GREATER) || defined(CATCH_COMPILER_MSC)
|
||||||
|
|
||||||
// We are already using this header either way, so there shouldn't
|
// We are already using this header either way, so there shouldn't
|
||||||
// be much additional overhead in including it to get the feature
|
// be much additional overhead in including it to get the feature
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
#include <catch2/internal/catch_debugger.hpp>
|
#include <catch2/internal/catch_debugger.hpp>
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_errno_guard.hpp>
|
#include <catch2/internal/catch_errno_guard.hpp>
|
||||||
#include <catch2/internal/catch_stream.hpp>
|
#include <catch2/internal/catch_stream.hpp>
|
||||||
#include <catch2/internal/catch_platform.hpp>
|
#include <catch2/internal/catch_platform.hpp>
|
||||||
@ -99,7 +101,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(CATCH_COMPILER_MSC)
|
||||||
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
|
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
bool isDebuggerActive() {
|
bool isDebuggerActive() {
|
||||||
|
@ -47,7 +47,7 @@ namespace Catch {
|
|||||||
|
|
||||||
#define CATCH_TRAP() raise(SIGTRAP)
|
#define CATCH_TRAP() raise(SIGTRAP)
|
||||||
#endif
|
#endif
|
||||||
#elif defined(_MSC_VER)
|
#elif defined(CATCH_COMPILER_MSC)
|
||||||
#define CATCH_TRAP() __debugbreak()
|
#define CATCH_TRAP() __debugbreak()
|
||||||
#elif defined(__MINGW32__)
|
#elif defined(__MINGW32__)
|
||||||
extern "C" __declspec(dllimport) void __stdcall DebugBreak();
|
extern "C" __declspec(dllimport) void __stdcall DebugBreak();
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
||||||
#pragma warning(disable:4018) // more "signed/unsigned mismatch"
|
#pragma warning(disable:4018) // more "signed/unsigned mismatch"
|
||||||
@ -257,7 +257,7 @@ namespace Catch {
|
|||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
#ifdef CATCH_COMPILER_CLANG
|
#ifdef CATCH_COMPILER_CLANG
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
#include <catch2/internal/catch_output_redirect.hpp>
|
#include <catch2/internal/catch_output_redirect.hpp>
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_enforce.hpp>
|
#include <catch2/internal/catch_enforce.hpp>
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -13,7 +15,7 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_NEW_CAPTURE)
|
#if defined(CATCH_CONFIG_NEW_CAPTURE)
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#include <io.h> //_dup and _dup2
|
#include <io.h> //_dup and _dup2
|
||||||
#define dup _dup
|
#define dup _dup
|
||||||
#define dup2 _dup2
|
#define dup2 _dup2
|
||||||
@ -59,7 +61,7 @@ namespace Catch {
|
|||||||
|
|
||||||
#if defined(CATCH_CONFIG_NEW_CAPTURE)
|
#if defined(CATCH_CONFIG_NEW_CAPTURE)
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
TempFile::TempFile() {
|
TempFile::TempFile() {
|
||||||
if (tmpnam_s(m_buffer)) {
|
if (tmpnam_s(m_buffer)) {
|
||||||
CATCH_RUNTIME_ERROR("Could not get a temp filename");
|
CATCH_RUNTIME_ERROR("Could not get a temp filename");
|
||||||
@ -87,7 +89,7 @@ namespace Catch {
|
|||||||
std::fclose(m_file);
|
std::fclose(m_file);
|
||||||
// We manually create the file on Windows only, on Linux
|
// We manually create the file on Windows only, on Linux
|
||||||
// it will be autodeleted
|
// it will be autodeleted
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
std::remove(m_buffer);
|
std::remove(m_buffer);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -137,7 +139,7 @@ namespace Catch {
|
|||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
#if defined(CATCH_CONFIG_NEW_CAPTURE)
|
#if defined(CATCH_CONFIG_NEW_CAPTURE)
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#undef dup
|
#undef dup
|
||||||
#undef dup2
|
#undef dup2
|
||||||
#undef fileno
|
#undef fileno
|
||||||
|
@ -85,7 +85,7 @@ namespace Catch {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::FILE* m_file = nullptr;
|
std::FILE* m_file = nullptr;
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
char m_buffer[L_tmpnam] = { 0 };
|
char m_buffer[L_tmpnam] = { 0 };
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -8,6 +8,8 @@
|
|||||||
#ifndef CATCH_PLATFORM_HPP_INCLUDED
|
#ifndef CATCH_PLATFORM_HPP_INCLUDED
|
||||||
#define CATCH_PLATFORM_HPP_INCLUDED
|
#define CATCH_PLATFORM_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
|
|
||||||
// See e.g.:
|
// See e.g.:
|
||||||
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html
|
// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
@ -22,7 +24,7 @@
|
|||||||
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
#elif defined(linux) || defined(__linux) || defined(__linux__)
|
||||||
# define CATCH_PLATFORM_LINUX
|
# define CATCH_PLATFORM_LINUX
|
||||||
|
|
||||||
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)
|
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(CATCH_COMPILER_MSC) || defined(__MINGW32__)
|
||||||
# define CATCH_PLATFORM_WINDOWS
|
# define CATCH_PLATFORM_WINDOWS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -7,11 +7,13 @@
|
|||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
#include <catch2/internal/catch_random_number_generator.hpp>
|
#include <catch2/internal/catch_random_number_generator.hpp>
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4146) // we negate uint32 during the rotate
|
#pragma warning(disable:4146) // we negate uint32 during the rotate
|
||||||
#endif
|
#endif
|
||||||
@ -22,7 +24,7 @@ namespace {
|
|||||||
return (val >> count) | (val << (-count & mask));
|
return (val >> count) | (val << (-count & mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -17,8 +17,10 @@
|
|||||||
* of Catch2 has its own combined TU like this.
|
* of Catch2 has its own combined TU like this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
||||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_console_width.hpp>
|
#include <catch2/internal/catch_console_width.hpp>
|
||||||
#include <catch2/internal/catch_errno_guard.hpp>
|
#include <catch2/internal/catch_errno_guard.hpp>
|
||||||
#include <catch2/internal/catch_textflow.hpp>
|
#include <catch2/internal/catch_textflow.hpp>
|
||||||
@ -68,7 +70,7 @@ namespace Catch {
|
|||||||
|
|
||||||
// Save previous errno, to prevent sprintf from overwriting it
|
// Save previous errno, to prevent sprintf from overwriting it
|
||||||
ErrnoGuard guard;
|
ErrnoGuard guard;
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
size_t printedLength = static_cast<size_t>(
|
size_t printedLength = static_cast<size_t>(
|
||||||
sprintf_s( buffer, "%.3f", duration ) );
|
sprintf_s( buffer, "%.3f", duration ) );
|
||||||
#else
|
#else
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
|
#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
|
||||||
// Note that 4062 (not all labels are handled and default is missing) is enabled
|
// Note that 4062 (not all labels are handled and default is missing) is enabled
|
||||||
@ -711,7 +711,7 @@ void ConsoleReporter::printTestFilters() {
|
|||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
||||||
#include <catch2/catch_tostring.hpp>
|
#include <catch2/catch_tostring.hpp>
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_string_manip.hpp>
|
#include <catch2/internal/catch_string_manip.hpp>
|
||||||
#include <catch2/internal/catch_textflow.hpp>
|
#include <catch2/internal/catch_textflow.hpp>
|
||||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
||||||
@ -28,7 +29,7 @@ namespace Catch {
|
|||||||
std::time(&rawtime);
|
std::time(&rawtime);
|
||||||
|
|
||||||
std::tm timeInfo = {};
|
std::tm timeInfo = {};
|
||||||
#if defined (_MSC_VER) || defined (__MINGW32__)
|
#if defined (CATCH_COMPILER_MSC) || defined (__MINGW32__)
|
||||||
gmtime_s(&timeInfo, &rawtime);
|
gmtime_s(&timeInfo, &rawtime);
|
||||||
#else
|
#else
|
||||||
gmtime_r(&rawtime, &timeInfo);
|
gmtime_r(&rawtime, &timeInfo);
|
||||||
|
@ -10,12 +10,13 @@
|
|||||||
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
#include <catch2/reporters/catch_reporter_helpers.hpp>
|
||||||
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
#include <catch2/interfaces/catch_interfaces_config.hpp>
|
||||||
#include <catch2/catch_test_spec.hpp>
|
#include <catch2/catch_test_spec.hpp>
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/internal/catch_string_manip.hpp>
|
#include <catch2/internal/catch_string_manip.hpp>
|
||||||
#include <catch2/internal/catch_list.hpp>
|
#include <catch2/internal/catch_list.hpp>
|
||||||
#include <catch2/catch_test_case_info.hpp>
|
#include <catch2/catch_test_case_info.hpp>
|
||||||
#include <catch2/internal/catch_move_and_forward.hpp>
|
#include <catch2/internal/catch_move_and_forward.hpp>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
|
#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch
|
||||||
// Note that 4062 (not all labels are handled
|
// Note that 4062 (not all labels are handled
|
||||||
@ -300,6 +301,6 @@ namespace Catch {
|
|||||||
|
|
||||||
} // end namespace Catch
|
} // end namespace Catch
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,12 +6,13 @@
|
|||||||
|
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
#include <catch2/catch_test_macros.hpp>
|
#include <catch2/catch_test_macros.hpp>
|
||||||
#include <catch2/internal/catch_enforce.hpp>
|
#include <catch2/internal/catch_enforce.hpp>
|
||||||
#include <catch2/internal/catch_case_insensitive_comparisons.hpp>
|
#include <catch2/internal/catch_case_insensitive_comparisons.hpp>
|
||||||
#include <catch2/internal/catch_optional.hpp>
|
#include <catch2/internal/catch_optional.hpp>
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4702) // unreachable code in the macro expansions
|
#pragma warning(disable:4702) // unreachable code in the macro expansions
|
||||||
#endif
|
#endif
|
||||||
@ -24,7 +25,7 @@ TEST_CASE("Check that our error handling macros throw the right exceptions", "[!
|
|||||||
REQUIRE_NOTHROW([](){CATCH_ENFORCE(true, "");}());
|
REQUIRE_NOTHROW([](){CATCH_ENFORCE(true, "");}());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(CATCH_COMPILER_MSC)
|
||||||
#pragma warning(pop) // unreachable code in the macro expansions
|
#pragma warning(pop) // unreachable code in the macro expansions
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ TEST_CASE("#1548", "[compilation]") {
|
|||||||
inline static void synchronizing_callback( void * ) { }
|
inline static void synchronizing_callback( void * ) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (_MSC_VER)
|
#if defined (CATCH_COMPILER_MSC)
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
// The function pointer comparison below triggers warning because of
|
// The function pointer comparison below triggers warning because of
|
||||||
// calling conventions
|
// calling conventions
|
||||||
@ -207,7 +207,7 @@ TEST_CASE("#1548", "[compilation]") {
|
|||||||
TestClass test;
|
TestClass test;
|
||||||
REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg);
|
REQUIRE(utility::synchronizing_callback != test.testMethod_uponComplete_arg);
|
||||||
}
|
}
|
||||||
#if defined (_MSC_VER)
|
#if defined (CATCH_COMPILER_MSC)
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ TEST_CASE( "Comparisons with int literals don't warn when mixing signed/ unsigne
|
|||||||
#pragma GCC diagnostic ignored "-Wsign-compare"
|
#pragma GCC diagnostic ignored "-Wsign-compare"
|
||||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(disable:4702) // Unreachable code -- unconditional throws and so on
|
#pragma warning(disable:4702) // Unreachable code -- unconditional throws and so on
|
||||||
#endif
|
#endif
|
||||||
#ifdef CATCH_COMPILER_CLANG
|
#ifdef CATCH_COMPILER_CLANG
|
||||||
|
@ -41,7 +41,7 @@ namespace {
|
|||||||
static bool alwaysTrue( int ) { return true; }
|
static bool alwaysTrue( int ) { return true; }
|
||||||
static bool alwaysFalse( int ) { return false; }
|
static bool alwaysFalse( int ) { return false; }
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
# pragma warning( disable : 4702 ) // Unreachable code -- MSVC 19 (VS 2015)
|
# pragma warning( disable : 4702 ) // Unreachable code -- MSVC 19 (VS 2015)
|
||||||
// sees right through the indirection
|
// sees right through the indirection
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,7 +221,7 @@ TEST_CASE( "CAPTURE can deal with complex expressions", "[messages][capture]" )
|
|||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free
|
#pragma GCC diagnostic ignored "-Wunused-value" // All the comma operators are side-effect free
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable:4709) // comma in indexing operator
|
#pragma warning(disable:4709) // comma in indexing operator
|
||||||
#endif
|
#endif
|
||||||
@ -283,6 +283,6 @@ TEST_CASE("CAPTURE parses string and character constants", "[messages][capture]"
|
|||||||
#ifdef CATCH_COMPILER_GCC
|
#ifdef CATCH_COMPILER_GCC
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning(pop)
|
#pragma warning(pop)
|
||||||
#endif
|
#endif
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#pragma clang diagnostic ignored "-Wpadded"
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef CATCH_COMPILER_MSC
|
||||||
#pragma warning (disable : 4702) // Disable unreachable code warning for the last test
|
#pragma warning (disable : 4702) // Disable unreachable code warning for the last test
|
||||||
// that is triggered when compiling as Win32|Release
|
// that is triggered when compiling as Win32|Release
|
||||||
#endif
|
#endif
|
||||||
|
4
third_party/clara.hpp
vendored
4
third_party/clara.hpp
vendored
@ -47,6 +47,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <catch2/internal/catch_compiler_capabilities.hpp>
|
||||||
|
|
||||||
#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
|
#ifndef CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH
|
||||||
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
|
#define CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80
|
||||||
#endif
|
#endif
|
||||||
@ -379,7 +381,7 @@ namespace clara { namespace TextFlow {
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if !defined(CLARA_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) )
|
#if !defined(CLARA_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(CATCH_COMPILER_MSC) )
|
||||||
#define CLARA_PLATFORM_WINDOWS
|
#define CLARA_PLATFORM_WINDOWS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user