From e2d21026d115dc61296b47dcc990534f1844bc7f Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 18 Jun 2020 14:46:14 -0400 Subject: Try using cmath or math.h depending on compiler to avoid issues around isinf etc. --- prelude/slang-cpp-prelude.h | 13 ++++++++++++- prelude/slang-cpp-scalar-intrinsics.h | 6 ------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/prelude/slang-cpp-prelude.h b/prelude/slang-cpp-prelude.h index 4a07674d1..d476676ed 100644 --- a/prelude/slang-cpp-prelude.h +++ b/prelude/slang-cpp-prelude.h @@ -3,7 +3,18 @@ #include "../slang.h" -#include +// Because the signiture of isnan, isfinite, and is isinf changed in C++, we use the macro +// to use the version in the std namespace. +// https://stackoverflow.com/questions/39130040/cmath-hides-isnan-in-math-h-in-c14-c11 + +#if SLANG_GCC_FAMILY && __GNUC__ < 6 +# include +# define SLANG_PRELUDE_STD std:: +#else +# include +# define SLANG_PRELUDE_STD +#endif + #include #include diff --git a/prelude/slang-cpp-scalar-intrinsics.h b/prelude/slang-cpp-scalar-intrinsics.h index f6c35e393..07945f1e0 100644 --- a/prelude/slang-cpp-scalar-intrinsics.h +++ b/prelude/slang-cpp-scalar-intrinsics.h @@ -8,12 +8,6 @@ # include #endif -// Because the signiture of isnan, isfinite, and is isinf changed in C++, we use the macro -// to use the version in the std namespace. -// https://stackoverflow.com/questions/39130040/cmath-hides-isnan-in-math-h-in-c14-c11 - -#define SLANG_PRELUDE_STD std:: - #ifdef SLANG_PRELUDE_NAMESPACE namespace SLANG_PRELUDE_NAMESPACE { #endif -- cgit v1.2.3