public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/ibuclaw/heads/mingw)] Move MinGW inside CRuntime_Microsoft version block
@ 2021-04-16  1:04 Iain Buclaw
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Buclaw @ 2021-04-16  1:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1e9ce7f6db629c12f8443246475401433311bd87

commit 1e9ce7f6db629c12f8443246475401433311bd87
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Apr 10 19:19:05 2021 +0200

    Move MinGW inside CRuntime_Microsoft version block

Diff:
---
 libphobos/libdruntime/core/stdc/math.d | 291 +++++++++++++++++----------------
 1 file changed, 147 insertions(+), 144 deletions(-)

diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index fba78ee233a..a3861f5dde3 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -424,92 +424,177 @@ else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
     pure int _fpclass(double x);
   }
 
+  version (MinGW)
+  {
     enum
     {
         ///
-        FP_SUBNORMAL = -2,
+        FP_NAN = 0x0100,
         ///
-        FP_NORMAL    = -1,
+        FP_NORMAL = 0x0400,
         ///
-        FP_ZERO      =  0,
+        FP_INFINITE = FP_NAN | FP_NORMAL,
         ///
-        FP_INFINITE  =  1,
+        FP_ZERO = 0x0400,
         ///
-        FP_NAN       =  2,
+        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
     }
 
-  extern(D)
-  {
-    //int fpclassify(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
-    ///
-    pure int fpclassify()(real x)
-    {
-        static if (real.sizeof == double.sizeof)
-            return fpclassify(cast(double) x);
-        else
-            static assert(false, "fpclassify(real) not supported by MS C runtime");
-    }
+    pure int __fpclassifyf(float x);
+    pure int __fpclassify(double x);
+    pure int __fpclassifyl(real x);
 
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+    pure int __isnanf(float x);
+    pure int __isnan(double x);
+    pure int __isnanl(real x);
 
-    //int isinf(real-floating x);
-    ///
-    pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+    pure int __signbitf(float x);
+    pure int __signbit(double x);
+    pure int __signbitl(real x);
 
-    //int isnan(real-floating x);
-    version (none) // requires MSVCRT 12+ (VS 2013)
+    extern (D)
     {
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+        pure int fpclassify(real x);
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+        pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+        pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
+        ///
+        extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+        pure int isnan(real x);
+
+        //int isnormal(real-floating x);
+        ///
+        int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
         ///
-        pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
+        ///
+        int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+        int signbit(real x);
     }
-    else // for backward compatibility with older runtimes
+  }
+  else
+  {
+    enum
     {
         ///
-        pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+        FP_SUBNORMAL = -2,
+        ///
+        FP_NORMAL    = -1,
         ///
-        extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+        FP_ZERO      =  0,
         ///
-        pure int isnan(real x)       { return _isnan(cast(double) x); }
+        FP_INFINITE  =  1,
+        ///
+        FP_NAN       =  2,
     }
 
-    //int isnormal(real-floating x);
-    ///
-    pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
-    ///
-    pure int signbit()(real x)
+    extern(D)
     {
-        static if (real.sizeof == double.sizeof)
-            return signbit(cast(double) x);
-        else
-            return (cast(short*)&(x))[4] & 0x8000;
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
+        ///
+        pure int fpclassify()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return fpclassify(cast(double) x);
+            else
+                static assert(false, "fpclassify(real) not supported by MS C runtime");
+        }
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        version (none) // requires MSVCRT 12+ (VS 2013)
+        {
+            ///
+            pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        }
+        else // for backward compatibility with older runtimes
+        {
+            ///
+            pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+            ///
+            extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+            ///
+            pure int isnan(real x)       { return _isnan(cast(double) x); }
+        }
+
+        //int isnormal(real-floating x);
+        ///
+        pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
+        ///
+        pure int signbit()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return signbit(cast(double) x);
+            else
+                return (cast(short*)&(x))[4] & 0x8000;
+        }
     }
   }
 }
@@ -835,88 +920,6 @@ else version (CRuntime_UClibc)
     int signbit(real x);
   }
 }
-else version (MinGW)
-{
-    enum
-    {
-        ///
-        FP_NAN = 0x0100,
-        ///
-        FP_NORMAL = 0x0400,
-        ///
-        FP_INFINITE = FP_NAN | FP_NORMAL,
-        ///
-        FP_ZERO = 0x0400,
-        ///
-        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
-    }
-
-    pure int __fpclassifyf(float x);
-    pure int __fpclassify(double x);
-    pure int __fpclassifyl(real x);
-
-    pure int __isnanf(float x);
-    pure int __isnan(double x);
-    pure int __isnanl(real x);
-
-    pure int __signbitf(float x);
-    pure int __signbit(double x);
-    pure int __signbitl(real x);
-
-  extern (D)
-  {
-    //int fpclassify(real-floating x);
-      ///
-    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
-    pure int fpclassify(real x);
-
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
-
-    //int isinf(real-floating x);
-    ///
-    pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
-
-    //int isnan(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
-    ///
-    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
-    pure int isnan(real x);
-
-    //int isnormal(real-floating x);
-    ///
-    int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
-    int signbit(real x);
-  }
-}
 else version (Darwin)
 {
     enum


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Move MinGW inside CRuntime_Microsoft version block
@ 2021-04-17 20:43 Iain Buclaw
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Buclaw @ 2021-04-17 20:43 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:6b0902dbdf0a96d34f1e13484738461baf2c5d43

commit 6b0902dbdf0a96d34f1e13484738461baf2c5d43
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Apr 10 19:19:05 2021 +0200

    Move MinGW inside CRuntime_Microsoft version block

Diff:
---
 libphobos/libdruntime/core/stdc/math.d | 291 +++++++++++++++++----------------
 1 file changed, 147 insertions(+), 144 deletions(-)

diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index fba78ee233a..a3861f5dde3 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -424,92 +424,177 @@ else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
     pure int _fpclass(double x);
   }
 
+  version (MinGW)
+  {
     enum
     {
         ///
-        FP_SUBNORMAL = -2,
+        FP_NAN = 0x0100,
         ///
-        FP_NORMAL    = -1,
+        FP_NORMAL = 0x0400,
         ///
-        FP_ZERO      =  0,
+        FP_INFINITE = FP_NAN | FP_NORMAL,
         ///
-        FP_INFINITE  =  1,
+        FP_ZERO = 0x0400,
         ///
-        FP_NAN       =  2,
+        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
     }
 
-  extern(D)
-  {
-    //int fpclassify(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
-    ///
-    pure int fpclassify()(real x)
-    {
-        static if (real.sizeof == double.sizeof)
-            return fpclassify(cast(double) x);
-        else
-            static assert(false, "fpclassify(real) not supported by MS C runtime");
-    }
+    pure int __fpclassifyf(float x);
+    pure int __fpclassify(double x);
+    pure int __fpclassifyl(real x);
 
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+    pure int __isnanf(float x);
+    pure int __isnan(double x);
+    pure int __isnanl(real x);
 
-    //int isinf(real-floating x);
-    ///
-    pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+    pure int __signbitf(float x);
+    pure int __signbit(double x);
+    pure int __signbitl(real x);
 
-    //int isnan(real-floating x);
-    version (none) // requires MSVCRT 12+ (VS 2013)
+    extern (D)
     {
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+        pure int fpclassify(real x);
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+        pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+        pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
+        ///
+        extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+        pure int isnan(real x);
+
+        //int isnormal(real-floating x);
+        ///
+        int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
         ///
-        pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
+        ///
+        int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+        int signbit(real x);
     }
-    else // for backward compatibility with older runtimes
+  }
+  else
+  {
+    enum
     {
         ///
-        pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+        FP_SUBNORMAL = -2,
+        ///
+        FP_NORMAL    = -1,
         ///
-        extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+        FP_ZERO      =  0,
         ///
-        pure int isnan(real x)       { return _isnan(cast(double) x); }
+        FP_INFINITE  =  1,
+        ///
+        FP_NAN       =  2,
     }
 
-    //int isnormal(real-floating x);
-    ///
-    pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
-    ///
-    pure int signbit()(real x)
+    extern(D)
     {
-        static if (real.sizeof == double.sizeof)
-            return signbit(cast(double) x);
-        else
-            return (cast(short*)&(x))[4] & 0x8000;
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
+        ///
+        pure int fpclassify()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return fpclassify(cast(double) x);
+            else
+                static assert(false, "fpclassify(real) not supported by MS C runtime");
+        }
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        version (none) // requires MSVCRT 12+ (VS 2013)
+        {
+            ///
+            pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        }
+        else // for backward compatibility with older runtimes
+        {
+            ///
+            pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+            ///
+            extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+            ///
+            pure int isnan(real x)       { return _isnan(cast(double) x); }
+        }
+
+        //int isnormal(real-floating x);
+        ///
+        pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
+        ///
+        pure int signbit()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return signbit(cast(double) x);
+            else
+                return (cast(short*)&(x))[4] & 0x8000;
+        }
     }
   }
 }
@@ -835,88 +920,6 @@ else version (CRuntime_UClibc)
     int signbit(real x);
   }
 }
-else version (MinGW)
-{
-    enum
-    {
-        ///
-        FP_NAN = 0x0100,
-        ///
-        FP_NORMAL = 0x0400,
-        ///
-        FP_INFINITE = FP_NAN | FP_NORMAL,
-        ///
-        FP_ZERO = 0x0400,
-        ///
-        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
-    }
-
-    pure int __fpclassifyf(float x);
-    pure int __fpclassify(double x);
-    pure int __fpclassifyl(real x);
-
-    pure int __isnanf(float x);
-    pure int __isnan(double x);
-    pure int __isnanl(real x);
-
-    pure int __signbitf(float x);
-    pure int __signbit(double x);
-    pure int __signbitl(real x);
-
-  extern (D)
-  {
-    //int fpclassify(real-floating x);
-      ///
-    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
-    pure int fpclassify(real x);
-
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
-
-    //int isinf(real-floating x);
-    ///
-    pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
-
-    //int isnan(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
-    ///
-    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
-    pure int isnan(real x);
-
-    //int isnormal(real-floating x);
-    ///
-    int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
-    int signbit(real x);
-  }
-}
 else version (Darwin)
 {
     enum


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Move MinGW inside CRuntime_Microsoft version block
@ 2021-04-13 20:42 Iain Buclaw
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Buclaw @ 2021-04-13 20:42 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:111f01c5e64f64ab2a6226a32129b884fb4a10f5

commit 111f01c5e64f64ab2a6226a32129b884fb4a10f5
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Apr 10 19:19:05 2021 +0200

    Move MinGW inside CRuntime_Microsoft version block

Diff:
---
 libphobos/libdruntime/core/stdc/math.d | 291 +++++++++++++++++----------------
 1 file changed, 147 insertions(+), 144 deletions(-)

diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index fba78ee233a..a3861f5dde3 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -424,92 +424,177 @@ else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
     pure int _fpclass(double x);
   }
 
+  version (MinGW)
+  {
     enum
     {
         ///
-        FP_SUBNORMAL = -2,
+        FP_NAN = 0x0100,
         ///
-        FP_NORMAL    = -1,
+        FP_NORMAL = 0x0400,
         ///
-        FP_ZERO      =  0,
+        FP_INFINITE = FP_NAN | FP_NORMAL,
         ///
-        FP_INFINITE  =  1,
+        FP_ZERO = 0x0400,
         ///
-        FP_NAN       =  2,
+        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
     }
 
-  extern(D)
-  {
-    //int fpclassify(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
-    ///
-    pure int fpclassify()(real x)
-    {
-        static if (real.sizeof == double.sizeof)
-            return fpclassify(cast(double) x);
-        else
-            static assert(false, "fpclassify(real) not supported by MS C runtime");
-    }
+    pure int __fpclassifyf(float x);
+    pure int __fpclassify(double x);
+    pure int __fpclassifyl(real x);
 
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+    pure int __isnanf(float x);
+    pure int __isnan(double x);
+    pure int __isnanl(real x);
 
-    //int isinf(real-floating x);
-    ///
-    pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+    pure int __signbitf(float x);
+    pure int __signbit(double x);
+    pure int __signbitl(real x);
 
-    //int isnan(real-floating x);
-    version (none) // requires MSVCRT 12+ (VS 2013)
+    extern (D)
     {
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+        pure int fpclassify(real x);
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+        pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+        pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
+        ///
+        extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+        pure int isnan(real x);
+
+        //int isnormal(real-floating x);
+        ///
+        int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
         ///
-        pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
+        ///
+        int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+        int signbit(real x);
     }
-    else // for backward compatibility with older runtimes
+  }
+  else
+  {
+    enum
     {
         ///
-        pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+        FP_SUBNORMAL = -2,
+        ///
+        FP_NORMAL    = -1,
         ///
-        extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+        FP_ZERO      =  0,
         ///
-        pure int isnan(real x)       { return _isnan(cast(double) x); }
+        FP_INFINITE  =  1,
+        ///
+        FP_NAN       =  2,
     }
 
-    //int isnormal(real-floating x);
-    ///
-    pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
-    ///
-    pure int signbit()(real x)
+    extern(D)
     {
-        static if (real.sizeof == double.sizeof)
-            return signbit(cast(double) x);
-        else
-            return (cast(short*)&(x))[4] & 0x8000;
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
+        ///
+        pure int fpclassify()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return fpclassify(cast(double) x);
+            else
+                static assert(false, "fpclassify(real) not supported by MS C runtime");
+        }
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        version (none) // requires MSVCRT 12+ (VS 2013)
+        {
+            ///
+            pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        }
+        else // for backward compatibility with older runtimes
+        {
+            ///
+            pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+            ///
+            extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+            ///
+            pure int isnan(real x)       { return _isnan(cast(double) x); }
+        }
+
+        //int isnormal(real-floating x);
+        ///
+        pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
+        ///
+        pure int signbit()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return signbit(cast(double) x);
+            else
+                return (cast(short*)&(x))[4] & 0x8000;
+        }
     }
   }
 }
@@ -835,88 +920,6 @@ else version (CRuntime_UClibc)
     int signbit(real x);
   }
 }
-else version (MinGW)
-{
-    enum
-    {
-        ///
-        FP_NAN = 0x0100,
-        ///
-        FP_NORMAL = 0x0400,
-        ///
-        FP_INFINITE = FP_NAN | FP_NORMAL,
-        ///
-        FP_ZERO = 0x0400,
-        ///
-        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
-    }
-
-    pure int __fpclassifyf(float x);
-    pure int __fpclassify(double x);
-    pure int __fpclassifyl(real x);
-
-    pure int __isnanf(float x);
-    pure int __isnan(double x);
-    pure int __isnanl(real x);
-
-    pure int __signbitf(float x);
-    pure int __signbit(double x);
-    pure int __signbitl(real x);
-
-  extern (D)
-  {
-    //int fpclassify(real-floating x);
-      ///
-    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
-    pure int fpclassify(real x);
-
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
-
-    //int isinf(real-floating x);
-    ///
-    pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
-
-    //int isnan(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
-    ///
-    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
-    pure int isnan(real x);
-
-    //int isnormal(real-floating x);
-    ///
-    int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
-    int signbit(real x);
-  }
-}
 else version (Darwin)
 {
     enum


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Move MinGW inside CRuntime_Microsoft version block
@ 2021-04-11 18:58 Iain Buclaw
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Buclaw @ 2021-04-11 18:58 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b90017c02476ad452fe042e90e5d3304c8262a0e

commit b90017c02476ad452fe042e90e5d3304c8262a0e
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Apr 10 19:19:05 2021 +0200

    Move MinGW inside CRuntime_Microsoft version block

Diff:
---
 libphobos/libdruntime/core/stdc/math.d | 291 +++++++++++++++++----------------
 1 file changed, 147 insertions(+), 144 deletions(-)

diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index fba78ee233a..a3861f5dde3 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -424,92 +424,177 @@ else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
     pure int _fpclass(double x);
   }
 
+  version (MinGW)
+  {
     enum
     {
         ///
-        FP_SUBNORMAL = -2,
+        FP_NAN = 0x0100,
         ///
-        FP_NORMAL    = -1,
+        FP_NORMAL = 0x0400,
         ///
-        FP_ZERO      =  0,
+        FP_INFINITE = FP_NAN | FP_NORMAL,
         ///
-        FP_INFINITE  =  1,
+        FP_ZERO = 0x0400,
         ///
-        FP_NAN       =  2,
+        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
     }
 
-  extern(D)
-  {
-    //int fpclassify(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
-    ///
-    pure int fpclassify()(real x)
-    {
-        static if (real.sizeof == double.sizeof)
-            return fpclassify(cast(double) x);
-        else
-            static assert(false, "fpclassify(real) not supported by MS C runtime");
-    }
+    pure int __fpclassifyf(float x);
+    pure int __fpclassify(double x);
+    pure int __fpclassifyl(real x);
 
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+    pure int __isnanf(float x);
+    pure int __isnan(double x);
+    pure int __isnanl(real x);
 
-    //int isinf(real-floating x);
-    ///
-    pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+    pure int __signbitf(float x);
+    pure int __signbit(double x);
+    pure int __signbitl(real x);
 
-    //int isnan(real-floating x);
-    version (none) // requires MSVCRT 12+ (VS 2013)
+    extern (D)
     {
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+        pure int fpclassify(real x);
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+        pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+        pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
+        ///
+        extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+        pure int isnan(real x);
+
+        //int isnormal(real-floating x);
+        ///
+        int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
         ///
-        pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
+        ///
+        int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+        int signbit(real x);
     }
-    else // for backward compatibility with older runtimes
+  }
+  else
+  {
+    enum
     {
         ///
-        pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+        FP_SUBNORMAL = -2,
+        ///
+        FP_NORMAL    = -1,
         ///
-        extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+        FP_ZERO      =  0,
         ///
-        pure int isnan(real x)       { return _isnan(cast(double) x); }
+        FP_INFINITE  =  1,
+        ///
+        FP_NAN       =  2,
     }
 
-    //int isnormal(real-floating x);
-    ///
-    pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
-    ///
-    pure int signbit()(real x)
+    extern(D)
     {
-        static if (real.sizeof == double.sizeof)
-            return signbit(cast(double) x);
-        else
-            return (cast(short*)&(x))[4] & 0x8000;
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
+        ///
+        pure int fpclassify()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return fpclassify(cast(double) x);
+            else
+                static assert(false, "fpclassify(real) not supported by MS C runtime");
+        }
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        version (none) // requires MSVCRT 12+ (VS 2013)
+        {
+            ///
+            pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        }
+        else // for backward compatibility with older runtimes
+        {
+            ///
+            pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+            ///
+            extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+            ///
+            pure int isnan(real x)       { return _isnan(cast(double) x); }
+        }
+
+        //int isnormal(real-floating x);
+        ///
+        pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
+        ///
+        pure int signbit()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return signbit(cast(double) x);
+            else
+                return (cast(short*)&(x))[4] & 0x8000;
+        }
     }
   }
 }
@@ -835,88 +920,6 @@ else version (CRuntime_UClibc)
     int signbit(real x);
   }
 }
-else version (MinGW)
-{
-    enum
-    {
-        ///
-        FP_NAN = 0x0100,
-        ///
-        FP_NORMAL = 0x0400,
-        ///
-        FP_INFINITE = FP_NAN | FP_NORMAL,
-        ///
-        FP_ZERO = 0x0400,
-        ///
-        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
-    }
-
-    pure int __fpclassifyf(float x);
-    pure int __fpclassify(double x);
-    pure int __fpclassifyl(real x);
-
-    pure int __isnanf(float x);
-    pure int __isnan(double x);
-    pure int __isnanl(real x);
-
-    pure int __signbitf(float x);
-    pure int __signbit(double x);
-    pure int __signbitl(real x);
-
-  extern (D)
-  {
-    //int fpclassify(real-floating x);
-      ///
-    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
-    pure int fpclassify(real x);
-
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
-
-    //int isinf(real-floating x);
-    ///
-    pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
-
-    //int isnan(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
-    ///
-    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
-    pure int isnan(real x);
-
-    //int isnormal(real-floating x);
-    ///
-    int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
-    int signbit(real x);
-  }
-}
 else version (Darwin)
 {
     enum


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Move MinGW inside CRuntime_Microsoft version block
@ 2021-04-10 17:21 Iain Buclaw
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Buclaw @ 2021-04-10 17:21 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ed636ad535bac72b52377a7db814f9bbed6961e4

commit ed636ad535bac72b52377a7db814f9bbed6961e4
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Apr 10 19:19:05 2021 +0200

    Move MinGW inside CRuntime_Microsoft version block

Diff:
---
 libphobos/libdruntime/core/stdc/math.d | 291 +++++++++++++++++----------------
 1 file changed, 147 insertions(+), 144 deletions(-)

diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index fba78ee233a..a3861f5dde3 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -424,92 +424,177 @@ else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
     pure int _fpclass(double x);
   }
 
+  version (MinGW)
+  {
     enum
     {
         ///
-        FP_SUBNORMAL = -2,
+        FP_NAN = 0x0100,
         ///
-        FP_NORMAL    = -1,
+        FP_NORMAL = 0x0400,
         ///
-        FP_ZERO      =  0,
+        FP_INFINITE = FP_NAN | FP_NORMAL,
         ///
-        FP_INFINITE  =  1,
+        FP_ZERO = 0x0400,
         ///
-        FP_NAN       =  2,
+        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
     }
 
-  extern(D)
-  {
-    //int fpclassify(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
-    ///
-    pure int fpclassify()(real x)
-    {
-        static if (real.sizeof == double.sizeof)
-            return fpclassify(cast(double) x);
-        else
-            static assert(false, "fpclassify(real) not supported by MS C runtime");
-    }
+    pure int __fpclassifyf(float x);
+    pure int __fpclassify(double x);
+    pure int __fpclassifyl(real x);
 
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+    pure int __isnanf(float x);
+    pure int __isnan(double x);
+    pure int __isnanl(real x);
 
-    //int isinf(real-floating x);
-    ///
-    pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+    pure int __signbitf(float x);
+    pure int __signbit(double x);
+    pure int __signbitl(real x);
 
-    //int isnan(real-floating x);
-    version (none) // requires MSVCRT 12+ (VS 2013)
+    extern (D)
     {
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+        pure int fpclassify(real x);
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+        pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+        pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
+        ///
+        extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+        pure int isnan(real x);
+
+        //int isnormal(real-floating x);
+        ///
+        int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
         ///
-        pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
+        ///
+        int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+        int signbit(real x);
     }
-    else // for backward compatibility with older runtimes
+  }
+  else
+  {
+    enum
     {
         ///
-        pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+        FP_SUBNORMAL = -2,
+        ///
+        FP_NORMAL    = -1,
         ///
-        extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+        FP_ZERO      =  0,
         ///
-        pure int isnan(real x)       { return _isnan(cast(double) x); }
+        FP_INFINITE  =  1,
+        ///
+        FP_NAN       =  2,
     }
 
-    //int isnormal(real-floating x);
-    ///
-    pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
-    ///
-    pure int signbit()(real x)
+    extern(D)
     {
-        static if (real.sizeof == double.sizeof)
-            return signbit(cast(double) x);
-        else
-            return (cast(short*)&(x))[4] & 0x8000;
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
+        ///
+        pure int fpclassify()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return fpclassify(cast(double) x);
+            else
+                static assert(false, "fpclassify(real) not supported by MS C runtime");
+        }
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        version (none) // requires MSVCRT 12+ (VS 2013)
+        {
+            ///
+            pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        }
+        else // for backward compatibility with older runtimes
+        {
+            ///
+            pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+            ///
+            extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+            ///
+            pure int isnan(real x)       { return _isnan(cast(double) x); }
+        }
+
+        //int isnormal(real-floating x);
+        ///
+        pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
+        ///
+        pure int signbit()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return signbit(cast(double) x);
+            else
+                return (cast(short*)&(x))[4] & 0x8000;
+        }
     }
   }
 }
@@ -835,88 +920,6 @@ else version (CRuntime_UClibc)
     int signbit(real x);
   }
 }
-else version (MinGW)
-{
-    enum
-    {
-        ///
-        FP_NAN = 0x0100,
-        ///
-        FP_NORMAL = 0x0400,
-        ///
-        FP_INFINITE = FP_NAN | FP_NORMAL,
-        ///
-        FP_ZERO = 0x0400,
-        ///
-        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
-    }
-
-    pure int __fpclassifyf(float x);
-    pure int __fpclassify(double x);
-    pure int __fpclassifyl(real x);
-
-    pure int __isnanf(float x);
-    pure int __isnan(double x);
-    pure int __isnanl(real x);
-
-    pure int __signbitf(float x);
-    pure int __signbit(double x);
-    pure int __signbitl(real x);
-
-  extern (D)
-  {
-    //int fpclassify(real-floating x);
-      ///
-    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
-    pure int fpclassify(real x);
-
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
-
-    //int isinf(real-floating x);
-    ///
-    pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
-
-    //int isnan(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
-    ///
-    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
-    pure int isnan(real x);
-
-    //int isnormal(real-floating x);
-    ///
-    int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
-    int signbit(real x);
-  }
-}
 else version (Darwin)
 {
     enum


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gcc(refs/users/ibuclaw/heads/mingw)] Move MinGW inside CRuntime_Microsoft version block
@ 2021-04-10 17:19 Iain Buclaw
  0 siblings, 0 replies; 6+ messages in thread
From: Iain Buclaw @ 2021-04-10 17:19 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:bc9bc1ffde66bb973a1573ed8da6dfec29c1cf6f

commit bc9bc1ffde66bb973a1573ed8da6dfec29c1cf6f
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Apr 10 19:19:05 2021 +0200

    Move MinGW inside CRuntime_Microsoft version block

Diff:
---
 libphobos/libdruntime/core/stdc/math.d | 291 +++++++++++++++++----------------
 1 file changed, 147 insertions(+), 144 deletions(-)

diff --git a/libphobos/libdruntime/core/stdc/math.d b/libphobos/libdruntime/core/stdc/math.d
index fba78ee233a..a3861f5dde3 100644
--- a/libphobos/libdruntime/core/stdc/math.d
+++ b/libphobos/libdruntime/core/stdc/math.d
@@ -424,92 +424,177 @@ else version (CRuntime_Microsoft) // fully supported since MSVCRT 12 (VS 2013) o
     pure int _fpclass(double x);
   }
 
+  version (MinGW)
+  {
     enum
     {
         ///
-        FP_SUBNORMAL = -2,
+        FP_NAN = 0x0100,
         ///
-        FP_NORMAL    = -1,
+        FP_NORMAL = 0x0400,
         ///
-        FP_ZERO      =  0,
+        FP_INFINITE = FP_NAN | FP_NORMAL,
         ///
-        FP_INFINITE  =  1,
+        FP_ZERO = 0x0400,
         ///
-        FP_NAN       =  2,
+        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
     }
 
-  extern(D)
-  {
-    //int fpclassify(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
-    ///
-    pure int fpclassify()(real x)
-    {
-        static if (real.sizeof == double.sizeof)
-            return fpclassify(cast(double) x);
-        else
-            static assert(false, "fpclassify(real) not supported by MS C runtime");
-    }
+    pure int __fpclassifyf(float x);
+    pure int __fpclassify(double x);
+    pure int __fpclassifyl(real x);
 
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
-    ///
-    pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+    pure int __isnanf(float x);
+    pure int __isnan(double x);
+    pure int __isnanl(real x);
 
-    //int isinf(real-floating x);
-    ///
-    pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+    pure int __signbitf(float x);
+    pure int __signbit(double x);
+    pure int __signbitl(real x);
 
-    //int isnan(real-floating x);
-    version (none) // requires MSVCRT 12+ (VS 2013)
+    extern (D)
     {
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
+        pure int fpclassify(real x);
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
+        ///
+        pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+        pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
         ///
-        pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+        pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
+        ///
+        extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
+        pure int isnan(real x);
+
+        //int isnormal(real-floating x);
+        ///
+        int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
         ///
-        pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
+        ///
+        int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
+        ///
+        extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
+        int signbit(real x);
     }
-    else // for backward compatibility with older runtimes
+  }
+  else
+  {
+    enum
     {
         ///
-        pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+        FP_SUBNORMAL = -2,
+        ///
+        FP_NORMAL    = -1,
         ///
-        extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+        FP_ZERO      =  0,
         ///
-        pure int isnan(real x)       { return _isnan(cast(double) x); }
+        FP_INFINITE  =  1,
+        ///
+        FP_NAN       =  2,
     }
 
-    //int isnormal(real-floating x);
-    ///
-    pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
-    ///
-    pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
-    ///
-    pure int signbit()(real x)
+    extern(D)
     {
-        static if (real.sizeof == double.sizeof)
-            return signbit(cast(double) x);
-        else
-            return (cast(short*)&(x))[4] & 0x8000;
+        //int fpclassify(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdclass") pure int fpclassify(float x);
+        ///
+        extern(C) pragma(mangle, "_dclass")  pure int fpclassify(double x);
+        ///
+        pure int fpclassify()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return fpclassify(cast(double) x);
+            else
+                static assert(false, "fpclassify(real) not supported by MS C runtime");
+        }
+
+        //int isfinite(real-floating x);
+        ///
+        pure int isfinite()(float x)     { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(double x)    { return fpclassify(x) <= 0; }
+        ///
+        pure int isfinite()(real x)      { return fpclassify(x) <= 0; }
+
+        //int isinf(real-floating x);
+        ///
+        pure int isinf()(float x)        { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(double x)       { return fpclassify(x) == FP_INFINITE; }
+        ///
+        pure int isinf()(real x)         { return fpclassify(x) == FP_INFINITE; }
+
+        //int isnan(real-floating x);
+        version (none) // requires MSVCRT 12+ (VS 2013)
+        {
+            ///
+            pure int isnan(float x)      { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(double x)     { return fpclassify(x) == FP_NAN; }
+            ///
+            pure int isnan(real x)       { return fpclassify(x) == FP_NAN; }
+        }
+        else // for backward compatibility with older runtimes
+        {
+            ///
+            pure int isnan(float x)      { version (Win64) return _isnanf(x); else return _isnan(cast(double) x); }
+            ///
+            extern(C) pragma(mangle, "_isnan") pure int isnan(double x);
+            ///
+            pure int isnan(real x)       { return _isnan(cast(double) x); }
+        }
+
+        //int isnormal(real-floating x);
+        ///
+        pure int isnormal()(float x)     { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(double x)    { return fpclassify(x) == FP_NORMAL; }
+        ///
+        pure int isnormal()(real x)      { return fpclassify(x) == FP_NORMAL; }
+
+        //int signbit(real-floating x);
+        ///
+        extern(C) pragma(mangle, "_fdsign") pure int signbit(float x);
+        ///
+        extern(C) pragma(mangle, "_dsign")  pure int signbit(double x);
+        ///
+        pure int signbit()(real x)
+        {
+            static if (real.sizeof == double.sizeof)
+                return signbit(cast(double) x);
+            else
+                return (cast(short*)&(x))[4] & 0x8000;
+        }
     }
   }
 }
@@ -835,88 +920,6 @@ else version (CRuntime_UClibc)
     int signbit(real x);
   }
 }
-else version (MinGW)
-{
-    enum
-    {
-        ///
-        FP_NAN = 0x0100,
-        ///
-        FP_NORMAL = 0x0400,
-        ///
-        FP_INFINITE = FP_NAN | FP_NORMAL,
-        ///
-        FP_ZERO = 0x0400,
-        ///
-        FP_SUBNORMAL = FP_NORMAL | FP_ZERO
-    }
-
-    pure int __fpclassifyf(float x);
-    pure int __fpclassify(double x);
-    pure int __fpclassifyl(real x);
-
-    pure int __isnanf(float x);
-    pure int __isnan(double x);
-    pure int __isnanl(real x);
-
-    pure int __signbitf(float x);
-    pure int __signbit(double x);
-    pure int __signbitl(real x);
-
-  extern (D)
-  {
-    //int fpclassify(real-floating x);
-      ///
-    extern(C) pragma(mangle, "__fpclassifyf") pure int fpclassify(float x);
-    ///
-    extern(C) pragma(mangle, "__fpclassify")  pure int fpclassify(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__fpclassify" : "__fpclassifyl")
-    pure int fpclassify(real x);
-
-    //int isfinite(real-floating x);
-    ///
-    pure int isfinite(float x)       { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(double x)      { return (fpclassify(x) & FP_NORMAL) == 0; }
-    ///
-    pure int isfinite(real x)        { return (fpclassify(x) & FP_NORMAL) == 0; }
-
-    //int isinf(real-floating x);
-    ///
-    pure int isinf(float x)          { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(double x)         { return fpclassify(x) == FP_INFINITE; }
-    ///
-    pure int isinf(real x)           { return fpclassify(x) == FP_INFINITE; }
-
-    //int isnan(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__isnanf") pure int isnan(float x);
-    ///
-    extern(C) pragma(mangle, "__isnan")  pure int isnan(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__isnan" : "__isnanl")
-    pure int isnan(real x);
-
-    //int isnormal(real-floating x);
-    ///
-    int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; }
-    ///
-    int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; }
-
-    //int signbit(real-floating x);
-    ///
-    extern(C) pragma(mangle, "__signbitf") pure int signbit(float x);
-    ///
-    extern(C) pragma(mangle, "__signbit")  pure int signbit(double x);
-    ///
-    extern(C) pragma(mangle, real.sizeof == double.sizeof ? "__signbit" : "__signbitl")
-    int signbit(real x);
-  }
-}
 else version (Darwin)
 {
     enum


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-17 20:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16  1:04 [gcc(refs/users/ibuclaw/heads/mingw)] Move MinGW inside CRuntime_Microsoft version block Iain Buclaw
  -- strict thread matches above, loose matches on Subject: below --
2021-04-17 20:43 Iain Buclaw
2021-04-13 20:42 Iain Buclaw
2021-04-11 18:58 Iain Buclaw
2021-04-10 17:21 Iain Buclaw
2021-04-10 17:19 Iain Buclaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).