Move compiler detection header beffore using

CATCH_COMPILER_CLANG macro. (see #2094)
This commit is contained in:
HoseynHeydari 2022-04-18 01:48:32 +04:30
parent e1827f7875
commit 56d04d2c5d
12 changed files with 18 additions and 17 deletions

View File

@ -156,7 +156,7 @@
////////////////////////////////////////////////////////////////////////////////
// Visual C++
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
# define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
# define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION __pragma( warning(pop) )

View File

@ -16,7 +16,7 @@
#endif
#if defined(_MSC_VER) && !defined(__clang__)
#define CATCH_COMPILER_MSC
#define CATCH_COMPILER_MSVC
#endif
#if defined(__MINGW32__)

View File

@ -19,7 +19,7 @@
#include <catch2/internal/catch_compiler_detections.hpp>
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
# if _MSC_VER >= 1900 // Visual Studio 2015 or newer
# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
# endif

View File

@ -18,7 +18,7 @@
// for C++14 or C++ libraries with incomplete support.
// We also have to handle that MSVC std lib will happily provide these
// under older standards.
#if defined(CATCH_CPP17_OR_GREATER) || defined(CATCH_COMPILER_MSC)
#if defined(CATCH_CPP17_OR_GREATER) || defined(CATCH_COMPILER_MSVC)
// We are already using this header either way, so there shouldn't
// be much additional overhead in including it to get the feature

View File

@ -101,7 +101,7 @@
return false;
}
} // namespace Catch
#elif defined(CATCH_COMPILER_MSC)
#elif defined(CATCH_COMPILER_MSVC)
extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent();
namespace Catch {
bool isDebuggerActive() {

View File

@ -47,7 +47,7 @@ namespace Catch {
#define CATCH_TRAP() raise(SIGTRAP)
#endif
#elif defined(CATCH_COMPILER_MSC)
#elif defined(CATCH_COMPILER_MSVC)
#define CATCH_TRAP() __debugbreak()
#elif defined(CATCH_COMPILER_MINGW32)
extern "C" __declspec(dllimport) void __stdcall DebugBreak();

View File

@ -15,7 +15,7 @@
#include <iosfwd>
#ifdef CATCH_COMPILER_MSC
#ifdef CATCH_COMPILER_MSVC
#pragma warning(push)
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#pragma warning(disable:4018) // more "signed/unsigned mismatch"
@ -257,7 +257,7 @@ namespace Catch {
} // end namespace Catch
#ifdef CATCH_COMPILER_MSC
#ifdef CATCH_COMPILER_MSVC
#pragma warning(pop)
#endif
#ifdef CATCH_COMPILER_CLANG

View File

@ -16,7 +16,7 @@
#include <sstream>
#if defined(CATCH_CONFIG_NEW_CAPTURE)
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
#include <io.h> //_dup and _dup2
#define dup _dup
#define dup2 _dup2
@ -62,7 +62,7 @@ namespace Catch {
#if defined(CATCH_CONFIG_NEW_CAPTURE)
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
TempFile::TempFile() {
if (tmpnam_s(m_buffer)) {
CATCH_RUNTIME_ERROR("Could not get a temp filename");
@ -90,7 +90,7 @@ namespace Catch {
std::fclose(m_file);
// We manually create the file on Windows only, on Linux
// it will be autodeleted
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
std::remove(m_buffer);
#endif
}
@ -140,7 +140,7 @@ namespace Catch {
} // namespace Catch
#if defined(CATCH_CONFIG_NEW_CAPTURE)
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
#undef dup
#undef dup2
#undef fileno

View File

@ -86,7 +86,7 @@ namespace Catch {
private:
std::FILE* m_file = nullptr;
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
char m_buffer[L_tmpnam] = { 0 };
#endif
};

View File

@ -24,7 +24,7 @@
#elif defined(linux) || defined(__linux) || defined(__linux__)
# define CATCH_PLATFORM_LINUX
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(CATCH_COMPILER_MSC) || defined(CATCH_COMPILER_MINGW32)
#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(CATCH_COMPILER_MSVC) || defined(CATCH_COMPILER_MINGW32)
# define CATCH_PLATFORM_WINDOWS
#endif

View File

@ -13,7 +13,7 @@ namespace Catch {
namespace {
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
#pragma warning(push)
#pragma warning(disable:4146) // we negate uint32 during the rotate
#endif
@ -24,7 +24,7 @@ namespace {
return (val >> count) | (val << (-count & mask));
}
#if defined(CATCH_COMPILER_MSC)
#if defined(CATCH_COMPILER_MSVC)
#pragma warning(pop)
#endif

View File

@ -8,12 +8,13 @@
#ifndef CATCH_TEST_SPEC_PARSER_HPP_INCLUDED
#define CATCH_TEST_SPEC_PARSER_HPP_INCLUDED
#include <catch2/internal/catch_compiler_detections.hpp>
#ifdef CATCH_COMPILER_CLANG
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
#include <catch2/internal/catch_compiler_detections.hpp>
#include <catch2/catch_test_spec.hpp>
#include <vector>