Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-16 Thread JonY via Mingw-w64-public

On 5/16/21 10:52 AM, Liu Hao wrote:

在 2021-05-16 18:49, JonY via Mingw-w64-public 写道:


Updated.





Thanks. LGTM.



Thanks for the review, pushed to master.


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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-16 Thread Liu Hao

在 2021-05-16 18:49, JonY via Mingw-w64-public 写道:


Updated.





Thanks. LGTM.


--
Best regards,
Liu Hao



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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-16 Thread JonY via Mingw-w64-public

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 +
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 ..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



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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-16 Thread Liu Hao

在 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.


--
Best regards,
Liu Hao



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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-16 Thread JonY via Mingw-w64-public

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 <10wa...@gmail.com>
Date: Sat, 15 May 2021 12:56:51 +
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 | 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 ..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



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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-16 Thread Liu Hao

在 2021-05-15 23:23, JonY via Mingw-w64-public 写道:


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




Yes, I think it should be `const double` instead of plain `double`.



--
Best regards,
Liu Hao



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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-16 Thread Liu Hao

在 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.



--
Best regards,
Liu Hao



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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-15 Thread JonY via Mingw-w64-public

On 5/15/21 2:03 PM, Liu Hao wrote:

在 2021-05-15 21:01, JonY via Mingw-w64-public 写道:

On 5/15/21 12:58 PM, JonY wrote:

Hi,

Attached patch OK?


Simplified patch.




Is it possible to declare it as `const double`? It need not be mutable.




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


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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-15 Thread Liu Hao

在 2021-05-15 21:01, JonY via Mingw-w64-public 写道:

On 5/15/21 12:58 PM, JonY wrote:

Hi,

Attached patch OK?


Simplified patch.




Is it possible to declare it as `const double`? It need not be mutable.



--
Best regards,
Liu Hao



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


Re: [Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-15 Thread JonY via Mingw-w64-public

On 5/15/21 12:58 PM, JonY wrote:

Hi,

Attached patch OK?


Simplified patch.
>From ff422cf04d8f9e105c68ac2ffdd25da4add8f8fb Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10wa...@gmail.com>
Date: Sat, 15 May 2021 12:56:51 +
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 | 4 
 2 files changed, 5 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 ..f1dd74c6
--- /dev/null
+++ b/mingw-w64-crt/math/_huge.c
@@ -0,0 +1,4 @@
+/* alias for UCRT, positive infinity */
+#include <_mingw.h>
+double _HUGE = __builtin_huge_val();
+double *__MINGW_IMP_SYMBOL(_HUGE) = &_HUGE;
-- 
2.31.1

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


[Mingw-w64-public] [PATCH] _HUGE for ucrt

2021-05-15 Thread JonY via Mingw-w64-public

Hi,

Attached patch OK?
From c9bef0201c412ee20531fdd777978644e0eef76c Mon Sep 17 00:00:00 2001
From: Jonathan Yong <10wa...@gmail.com>
Date: Sat, 15 May 2021 12:56:51 +
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 | 7 +++
 2 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 ..753f7122
--- /dev/null
+++ b/mingw-w64-crt/math/_huge.c
@@ -0,0 +1,7 @@
+/* alias for UCRT, positive infinity */
+#define _HUGE
+#include 
+#undef _HUGE
+
+double _HUGE = __builtin_huge_val();
+double *__MINGW_IMP_SYMBOL(_HUGE) = &_HUGE;
-- 
2.31.1



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