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 <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2018-11-03 14:02:58 +00:00
parent be09a9a835
commit f65d7b2e64
1 changed files with 5 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <ctype.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#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);
}