Module Name:    src
Committed By:   martin
Date:           Sat Jun 23 10:43:57 UTC 2018

Modified Files:
        src/external/gpl3/gcc/dist/libstdc++-v3/include/std [netbsd-7]: complex

Log Message:
Pull up following revision(s) (requested by maya in ticket #1617):

        external/gpl3/gcc/dist/libstdc++-v3/include/std/complex: revision 1.2

PR/50646: Use the c99 cabs math builtins directly, because cabs and cabsf
have broken ABI's can cabsl does not exist. The correct(?) probably fix is
to change the cabs builtins to point to the c99 variants directly...

XXX: pullup-7 and the same file from the gcc.old tree.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.1.1.2.4.1 \
    src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex
diff -u src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex:1.1.1.2 src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex:1.1.1.2.4.1
--- src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex:1.1.1.2	Sat Mar  1 08:41:31 2014
+++ src/external/gpl3/gcc/dist/libstdc++-v3/include/std/complex	Sat Jun 23 10:43:57 2018
@@ -44,6 +44,16 @@
 #include <cmath>
 #include <sstream>
 
+#if _GLIBCXX_USE_C99_COMPLEX
+// This is disgusting; we can't include ccomplex because that c++11
+// and we can't use the builtins because those point to the wrong
+// ABI-wise cabs/cabsf so we manually declare those here and use
+// them directly.
+extern "C" float __c99_cabsf(_Complex float);
+extern "C" double __c99_cabs(_Complex double);
+extern "C" long double __c99_cabsl(_Complex long double);
+#endif
+
 // Get rid of a macro possibly defined in <complex.h>
 #undef complex
 
@@ -580,15 +590,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     }
 
 #if _GLIBCXX_USE_C99_COMPLEX
+  // XXX: We can't use __builtin_cabs* because they are broken
   inline float
-  __complex_abs(__complex__ float __z) { return __builtin_cabsf(__z); }
+  __complex_abs(__complex__ float __z) { return __c99_cabsf(__z); }
 
   inline double
-  __complex_abs(__complex__ double __z) { return __builtin_cabs(__z); }
+  __complex_abs(__complex__ double __z) { return __c99_cabs(__z); }
 
   inline long double
   __complex_abs(const __complex__ long double& __z)
-  { return __builtin_cabsl(__z); }
+  { return __c99_cabsl(__z); }
 
   template<typename _Tp>
     inline _Tp

Reply via email to