On 5/16/21 9:36 AM, Liu Hao wrote:
在 2021-05-16 17:21, JonY via Mingw-w64-public 写道:
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

Because of the check for `_HUGE`, is it necessary to keep it as such, by `#define _HUGE _HUGE`?

In old MSVC CRT headers it was not a macro, which has already been an deviation.


Updated.
From 5a4f14f69909ff85eb661a18f098cf53100e98fe Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10wa...@gmail.com>
Date: Sat, 15 May 2021 12:56:51 +0000
Subject: [PATCH] crt: _HUGE for UCRT

Signed-off-by: Jonathan Yong <10wa...@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 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..59560a35 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__
-- 
2.31.1

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to