[pypy-commit] cffi default: check for ARM using a flag like it is done for MSVC

bivab noreply at buildbot.pypy.org
Sun Jun 16 21:36:24 CEST 2013


Author: David Schneider <david.schneider at picle.org>
Branch: 
Changeset: r1269:58dc7182ce4d
Date: 2013-06-16 13:44 -0500
http://bitbucket.org/cffi/cffi/changeset/58dc7182ce4d/

Log:	check for ARM using a flag like it is done for MSVC

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -3425,6 +3425,7 @@
 }
 
 #define SF_MSVC_BITFIELDS 1
+#define SF_GCC_ARM_BITFIELDS 2
 
 static PyObject *b_complete_struct_or_union(PyObject *self, PyObject *args)
 {
@@ -3439,7 +3440,11 @@
 #ifdef MS_WIN32
     int sflags = SF_MSVC_BITFIELDS;
 #else
+# ifdef __arm__
+    int sflags = SF_GCC_ARM_BITFIELDS;
+# else
     int sflags = 0;
+# endif
 #endif
 
     if (!PyArg_ParseTuple(args, "O!O!|Onii:complete_struct_or_union",
@@ -3503,8 +3508,7 @@
             goto error;
 
         do_align = 1;
-#ifndef __arm__
-        if (fbitsize >= 0) {
+        if (!(sflags & SF_GCC_ARM_BITFIELDS) && fbitsize >= 0) {
             if (!(sflags & SF_MSVC_BITFIELDS)) {
                 /* GCC: anonymous bitfields (of any size) don't cause alignment */
                 do_align = PyText_GetSize(fname) > 0;
@@ -3514,7 +3518,6 @@
                 do_align = fbitsize > 0;
             }
         }
-#endif
         if (alignment < falign && do_align)
             alignment = falign;
 


More information about the pypy-commit mailing list