From 5a4f14f69909ff85eb661a18f098cf53100e98fe Mon Sep 17 00:00:00 2001 From: Jonathan Yong <10walls@gmail.com> Date: Sat, 15 May 2021 12:56:51 +0000 Subject: [PATCH] crt: _HUGE for UCRT Signed-off-by: Jonathan Yong <10walls@gmail.com> --- mingw-w64-crt/Makefile.am | 1 + mingw-w64-crt/math/_huge.c | 2 ++ mingw-w64-headers/crt/math.h | 5 +++++ 3 files changed, 8 insertions(+) create mode 100644 mingw-w64-crt/math/_huge.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 1f48b72e7..47db28bfb 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -229,6 +229,7 @@ src_msvcrt=\ src_ucrtbase=\ crt/ucrtbase_compat.c \ + math/_huge.c \ stdio/ucrt_fprintf.c \ stdio/ucrt_fscanf.c \ stdio/ucrt_fwprintf.c \ diff --git a/mingw-w64-crt/math/_huge.c b/mingw-w64-crt/math/_huge.c new file mode 100644 index 000000000..dd43f841a --- /dev/null +++ b/mingw-w64-crt/math/_huge.c @@ -0,0 +1,2 @@ +/* For UCRT, positive infinity */ +double const _HUGE = __builtin_huge_val(); diff --git a/mingw-w64-headers/crt/math.h b/mingw-w64-headers/crt/math.h index 3754dc64e..59560a351 100644 --- a/mingw-w64-headers/crt/math.h +++ b/mingw-w64-headers/crt/math.h @@ -143,8 +143,13 @@ extern "C" { #endif #ifndef _HUGE +#ifdef _UCRT + extern double const _HUGE; +#define _HUGE _HUGE +#else extern double * __MINGW_IMP_SYMBOL(_HUGE); #define _HUGE (* __MINGW_IMP_SYMBOL(_HUGE)) +#endif /* _UCRT */ #endif #ifdef __GNUC__