From c912f62fc46b2c1ab048399a5dadda703952dddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 5 Feb 2022 16:21:06 +0100 Subject: [PATCH] Remove Windows.h related defines --- docs/configuration.md | 8 -------- src/catch2/internal/catch_windows_h_proxy.hpp | 15 ++++----------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index fa77ef54..a7db4b13 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -11,7 +11,6 @@ [C++11 toggles](#c11-toggles)
[C++17 toggles](#c17-toggles)
[Other toggles](#other-toggles)
-[Windows header clutter](#windows-header-clutter)
[Enabling stringification](#enabling-stringification)
[Disabling exceptions](#disabling-exceptions)
[Overriding Catch's debug break (`-b`)](#overriding-catchs-debug-break--b)
@@ -181,13 +180,6 @@ This feature is considered experimental and might change at any point. _Inspired by Doctest's `DOCTEST_CONFIG_DISABLE`_ -## Windows header clutter - -On Windows Catch includes `windows.h`. To minimize global namespace clutter in the implementation file, it defines `NOMINMAX` and `WIN32_LEAN_AND_MEAN` before including it. You can control this behaviour via two macros: - - CATCH_CONFIG_NO_NOMINMAX // Stops Catch from using NOMINMAX macro - CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN // Stops Catch from using WIN32_LEAN_AND_MEAN macro - ## Enabling stringification diff --git a/src/catch2/internal/catch_windows_h_proxy.hpp b/src/catch2/internal/catch_windows_h_proxy.hpp index a4c11fa6..14fe747d 100644 --- a/src/catch2/internal/catch_windows_h_proxy.hpp +++ b/src/catch2/internal/catch_windows_h_proxy.hpp @@ -12,12 +12,12 @@ #if defined(CATCH_PLATFORM_WINDOWS) -#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) -# define CATCH_DEFINED_NOMINMAX +// We might end up with the define made globally through the compiler, +// and we don't want to trigger warnings for this +#if !defined(NOMINMAX) # define NOMINMAX #endif -#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN) -# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN +#if !defined(WIN32_LEAN_AND_MEAN) # define WIN32_LEAN_AND_MEAN #endif @@ -27,13 +27,6 @@ #include #endif -#ifdef CATCH_DEFINED_NOMINMAX -# undef NOMINMAX -#endif -#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN -# undef WIN32_LEAN_AND_MEAN -#endif - #endif // defined(CATCH_PLATFORM_WINDOWS) #endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED