mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Add support for the IAR compiler
This commit is contained in:
parent
0a0ebf5003
commit
3220ae6d4a
@ -10,7 +10,7 @@
|
|||||||
#ifndef CATCH_OPTIMIZER_HPP_INCLUDED
|
#ifndef CATCH_OPTIMIZER_HPP_INCLUDED
|
||||||
#define 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
|
# include <atomic> // atomic_thread_fence
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -32,16 +32,23 @@ 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(_MSC_VER) || defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
|
||||||
|
#if defined(_MSVC_VER)
|
||||||
#pragma optimize("", off)
|
#pragma optimize("", off)
|
||||||
|
#elif defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
// For IAR the pragma only affects the following function
|
||||||
|
#pragma optimize=disable
|
||||||
|
#endif
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void keep_memory(T* p) {
|
inline void keep_memory(T* p) {
|
||||||
// thanks @milleniumbug
|
// thanks @milleniumbug
|
||||||
*reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p);
|
*reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p);
|
||||||
}
|
}
|
||||||
// TODO equivalent keep_memory()
|
// TODO equivalent keep_memory()
|
||||||
|
#if defined(_MSVC_VER)
|
||||||
#pragma optimize("", on)
|
#pragma optimize("", on)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Detail {
|
namespace Detail {
|
||||||
inline void optimizer_barrier() {
|
inline void optimizer_barrier() {
|
||||||
|
@ -33,6 +33,8 @@ namespace Catch {
|
|||||||
gmtime_s(&timeInfo, &rawtime);
|
gmtime_s(&timeInfo, &rawtime);
|
||||||
#elif defined (CATCH_PLATFORM_PLAYSTATION)
|
#elif defined (CATCH_PLATFORM_PLAYSTATION)
|
||||||
gmtime_s(&rawtime, &timeInfo);
|
gmtime_s(&rawtime, &timeInfo);
|
||||||
|
#elif defined (__IAR_SYSTEMS_ICC__)
|
||||||
|
timeInfo = *std::gmtime(&rawtime);
|
||||||
#else
|
#else
|
||||||
gmtime_r(&rawtime, &timeInfo);
|
gmtime_r(&rawtime, &timeInfo);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user