Author: Armin Rigo <[email protected]>
Branch: sirtom67/float_complex
Changeset: r2939:c7a53457ef79
Date: 2017-05-29 19:29 +0200
http://bitbucket.org/cffi/cffi/changeset/c7a53457ef79/

Log:    MSVC might not support _Complex (and the include <complex.h>).

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -7,6 +7,8 @@
 #ifdef MS_WIN32
 #include <windows.h>
 #include "misc_win32.h"
+typedef float cffi_float_complex_t[2];
+typedef double cffi_double_complex_t[2];
 #else
 #include <stddef.h>
 #include <stdint.h>
@@ -14,6 +16,8 @@
 #include <errno.h>
 #include <ffi.h>
 #include <sys/mman.h>
+typedef float _Complex cffi_float_complex_t; /* use the def above if your C */
+typedef double _Complex cffi_double_complex_t; /*   compiler complains here */
 #endif
 
 /* this block of #ifs should be kept exactly identical between
@@ -4095,8 +4099,8 @@
        EPTYPE(f, float, CT_PRIMITIVE_FLOAT )                    \
        EPTYPE(d, double, CT_PRIMITIVE_FLOAT )                   \
        EPTYPE(ld, long double, CT_PRIMITIVE_FLOAT | CT_IS_LONGDOUBLE ) \
-       EPTYPE(fc, float _Complex, CT_PRIMITIVE_COMPLEX )        \
-       EPTYPE(dc, double _Complex, CT_PRIMITIVE_COMPLEX )       \
+       EPTYPE2(fc, "float _Complex", cffi_float_complex_t, 
CT_PRIMITIVE_COMPLEX ) \
+       EPTYPE2(dc, "double _Complex", cffi_double_complex_t, 
CT_PRIMITIVE_COMPLEX ) \
        ENUM_PRIMITIVE_TYPES_WCHAR                               \
        EPTYPE(b, _Bool, CT_PRIMITIVE_UNSIGNED | CT_IS_BOOL )    \
      /* the following types are not primitive in the C sense */ \
@@ -6720,6 +6724,7 @@
 }
 
 #if 0   /* libffi doesn't properly support complexes currently */
+        /* also, MSVC might not support _Complex... */
 static float _Complex _testfunc24(float a, float b)
 {
     return a + I*2.0*b;
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to