diff options
| author | jushar | 2023-03-08 13:14:29 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2023-03-08 20:55:41 +0100 |
| commit | 3220ae6d4aff68edb27fa6b34d2e4f909a770e19 (patch) | |
| tree | 4478a7b7a5afa0437d7d785b4af4e491fe786525 /src | |
| parent | 0a0ebf50034831718ffc63c6d12abb1fa469d6e9 (diff) | |
| download | catch3-3220ae6d4aff68edb27fa6b34d2e4f909a770e19.tar.gz | |
Add support for the IAR compiler
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/benchmark/catch_optimizer.hpp | 11 | ||||
| -rw-r--r-- | src/catch2/reporters/catch_reporter_junit.cpp | 2 |
2 files changed, 11 insertions, 2 deletions
diff --git a/src/catch2/benchmark/catch_optimizer.hpp b/src/catch2/benchmark/catch_optimizer.hpp index 0dbfc145..02cf2073 100644 --- a/src/catch2/benchmark/catch_optimizer.hpp +++ b/src/catch2/benchmark/catch_optimizer.hpp @@ -10,7 +10,7 @@ #ifndef CATCH_OPTIMIZER_HPP_INCLUDED #define CATCH_OPTIMIZER_HPP_INCLUDED -#if defined(_MSC_VER) +#if defined(_MSC_VER) || defined(__IAR_SYSTEMS_ICC__) # include <atomic> // atomic_thread_fence #endif @@ -32,16 +32,23 @@ namespace Catch { namespace Detail { inline void optimizer_barrier() { keep_memory(); } } // namespace Detail -#elif defined(_MSC_VER) +#elif defined(_MSC_VER) || defined(__IAR_SYSTEMS_ICC__) +#if defined(_MSVC_VER) #pragma optimize("", off) +#elif defined(__IAR_SYSTEMS_ICC__) +// For IAR the pragma only affects the following function +#pragma optimize=disable +#endif template <typename T> inline void keep_memory(T* p) { // thanks @milleniumbug *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p); } // TODO equivalent keep_memory() +#if defined(_MSVC_VER) #pragma optimize("", on) +#endif namespace Detail { inline void optimizer_barrier() { diff --git a/src/catch2/reporters/catch_reporter_junit.cpp b/src/catch2/reporters/catch_reporter_junit.cpp index 22d6526f..9a9b94af 100644 --- a/src/catch2/reporters/catch_reporter_junit.cpp +++ b/src/catch2/reporters/catch_reporter_junit.cpp @@ -33,6 +33,8 @@ namespace Catch { gmtime_s(&timeInfo, &rawtime); #elif defined (CATCH_PLATFORM_PLAYSTATION) gmtime_s(&rawtime, &timeInfo); +#elif defined (__IAR_SYSTEMS_ICC__) + timeInfo = *std::gmtime(&rawtime); #else gmtime_r(&rawtime, &timeInfo); #endif |