On 5/16/21 8:25 AM, Liu Hao wrote:
在 2021-05-15 23:23, JonY via Mingw-w64-public 写道:

The prototype declares it as a non-const, will it be a problem?



In addition, it looks like UCRT doesn't declare it as an imported symbol any more. It's plain `extern double const _HUGE;` now.



Patch updated.
From 98dd88793f9f54a77c58c8bffbe673a09d9abf7c Mon Sep 17 00:00:00 2001
From: Jonathan Yong <[email protected]>
Date: Sat, 15 May 2021 12:56:51 +0000
Subject: [PATCH] crt: _HUGE for UCRT

Signed-off-by: Jonathan Yong <[email protected]>
---
 mingw-w64-crt/Makefile.am    | 1 +
 mingw-w64-crt/math/_huge.c   | 2 ++
 mingw-w64-headers/crt/math.h | 4 ++++
 3 files changed, 7 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 1f48b72e..47db28bf 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 00000000..dd43f841
--- /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 3754dc64..b9277bd0 100644
--- a/mingw-w64-headers/crt/math.h
+++ b/mingw-w64-headers/crt/math.h
@@ -143,8 +143,12 @@ extern "C" {
 #endif
 
 #ifndef _HUGE
+#ifdef _UCRT
+  extern double const _HUGE;
+#else
   extern double * __MINGW_IMP_SYMBOL(_HUGE);
 #define _HUGE	(* __MINGW_IMP_SYMBOL(_HUGE))
+#endif /* _UCRT */
 #endif
 
 #ifdef __GNUC__
-- 
2.31.1

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to