From 5a62d004804f0b9fbf9758ddf63ad87f493fc558 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Tue, 3 May 2022 10:41:05 +0200 Subject: [PATCH] util: fix test on msvc We also miss this function on MSVC. But let's use the functionality in meson to check for supported functions instead of hand-rolling the list here. Fixes: 067023dce2c ("util: Add some unit tests of the half-float conversions.") Reviewed-by: Emma Anholt Reviewed-by: Dylan Baker Reviewed-by: Chia-I Wu Part-of: --- meson.build | 5 +++++ src/util/tests/half_float_test.cpp | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 9b65c15..4e4d9e7 100644 --- a/meson.build +++ b/meson.build @@ -1438,6 +1438,11 @@ elif with_tools.contains('intel') error('Intel tools require the program_invocation_name variable') endif +if cc.has_header_symbol('math.h', 'issignaling', + args : '-D_GNU_SOURCE') + pre_args += '-DHAVE_ISSIGNALING' +endif + # MinGW provides a __builtin_posix_memalign function, but not a posix_memalign. # This means that this check will succeed, but then compilation will later # fail. MSVC doesn't have this function at all, so only check for it on diff --git a/src/util/tests/half_float_test.cpp b/src/util/tests/half_float_test.cpp index f3f5aa6..051e0d0 100644 --- a/src/util/tests/half_float_test.cpp +++ b/src/util/tests/half_float_test.cpp @@ -38,8 +38,7 @@ #define HALF_NEG_INF 0xfc00 #define HALF_NAN 0x7e00 -#if defined(ANDROID) || defined (__MINGW32__) -/* Android and mingw were missing this function, roll our own as a best effort. */ +#ifndef HAVE_ISSIGNALING static bool issignaling(float x) { uint32_t ui = fui(x); -- 2.7.4