From f96e89e016802fb219c9158ac74a21f3aae6abc9 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Fri, 31 Jan 2020 21:54:16 -0800 Subject: [PATCH 1/2] catch_compiler_capabilities.h: use proper math define C++11 math requires _GLIBCXX_USE_C99_MATH_TR1 to be true with gcc/clang. Also fixes an issue with uClibc-ng where __UCLIBC__ is defined in features.h but that is not included here and is thus no-op. --- include/internal/catch_compiler_capabilities.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h index 0cc7ed40..9eebd8de 100644 --- a/include/internal/catch_compiler_capabilities.h +++ b/include/internal/catch_compiler_capabilities.h @@ -203,7 +203,7 @@ #define CATCH_CONFIG_COLOUR_NONE #endif -#if defined(__UCLIBC__) +#if !defined(_GLIBCXX_USE_C99_MATH_TR1) #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER #endif From 2652bb86e3f72292951dfb5ad272a7c0a018118c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 3 Feb 2020 10:05:17 +0100 Subject: [PATCH 2/2] Cleanup nextafter workaround --- include/internal/catch_matchers_floating.cpp | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/include/internal/catch_matchers_floating.cpp b/include/internal/catch_matchers_floating.cpp index c226fc56..bcca0725 100644 --- a/include/internal/catch_matchers_floating.cpp +++ b/include/internal/catch_matchers_floating.cpp @@ -59,16 +59,8 @@ namespace { return static_cast(ulpDiff) <= maxUlpDiff; } -} //end anonymous namespace - #if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -#if defined(__clang__) -#pragma clang diagnostic push -// The long double overload is currently unused -#pragma clang diagnostic ignored "-Wunused-function" -#endif - float nextafter(float x, float y) { return ::nextafterf(x, y); } @@ -77,18 +69,8 @@ namespace { return ::nextafter(x, y); } - long double nextafter(long double x, long double y) { - return ::nextafterl(x, y); - } - -#if defined(__clang__) -#pragma clang diagnostic pop -#endif - #endif // ^^^ CATCH_CONFIG_GLOBAL_NEXTAFTER ^^^ -namespace { - template FP step(FP start, FP direction, uint64_t steps) { for (uint64_t i = 0; i < steps; ++i) {