mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-26 15:26:11 +01:00
Fix warning suppressions leaking under clang.exe
When running clang.exe under Windows, catch.hpp leaks warning suppressions because it uses `#pragma warning(push)` & `#pragma warning(pop)` around warning suppressions like `#pragma clang diagnostic ignore "-Wunused-variable"`, instead of using `#pragma clang diagnostic push` and `#pragma clang diagnostic pop`. This fixes that by only defining `CATCH_INTERNAL_START_WARNINGS_SUPPRESSION` and `CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION` to be the cl.exe variants if `defined(_MSC_VER) && !defined(__clang__)`.
This commit is contained in:
parent
c4e3767e26
commit
4b9780201b
@ -146,10 +146,6 @@
|
|||||||
// Visual C++
|
// Visual C++
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
|
||||||
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
|
||||||
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
|
||||||
|
|
||||||
|
|
||||||
// Universal Windows platform does not support SEH
|
// Universal Windows platform does not support SEH
|
||||||
// Or console colours (or console at all...)
|
// Or console colours (or console at all...)
|
||||||
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
|
||||||
@ -158,13 +154,18 @@
|
|||||||
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
|
# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
# if !defined(__clang__) // Handle Clang masquerading for msvc
|
||||||
|
|
||||||
// MSVC traditional preprocessor needs some workaround for __VA_ARGS__
|
// MSVC traditional preprocessor needs some workaround for __VA_ARGS__
|
||||||
// _MSVC_TRADITIONAL == 0 means new conformant preprocessor
|
// _MSVC_TRADITIONAL == 0 means new conformant preprocessor
|
||||||
// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
|
// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor
|
||||||
# if !defined(__clang__) // Handle Clang masquerading for msvc
|
|
||||||
# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
|
# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)
|
||||||
# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR
|
||||||
# endif // MSVC_TRADITIONAL
|
# endif // MSVC_TRADITIONAL
|
||||||
|
|
||||||
|
// Only do this if we're not using clang on Windows, which uses `diagnostic push` & `diagnostic pop`
|
||||||
|
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
|
||||||
|
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )
|
||||||
# endif // __clang__
|
# endif // __clang__
|
||||||
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
Loading…
Reference in New Issue
Block a user