From f65d7b2e64549282570554ba447ad6ccdc8a777a Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 3 Nov 2018 14:02:58 +0000 Subject: [PATCH] Fix unsupported optimize attribute on clang Use optnone instead, this does require a more recent clang though. In general, just don't use -ffast-math. Signed-off-by: Yuxuan Shui --- src/utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/utils.h b/src/utils.h index fbb88b2d..eb4602f8 100644 --- a/src/utils.h +++ b/src/utils.h @@ -4,6 +4,7 @@ #include #include #include +#include #include #ifdef __FAST_MATH__ @@ -11,7 +12,11 @@ therefore it is not recommended. #endif +#ifdef __clang__ +__attribute__((optnone)) +#else __attribute__((optimize("-fno-fast-math"))) +#endif static inline bool safe_isnan(double a) { return isnan(a); }