Commits

David Schneider committed 58dc718

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

  • Participants
  • Parent commits 09f85e9

Comments (0)

Files changed (1)

c/_cffi_backend.c

 }
 
 #define SF_MSVC_BITFIELDS 1
+#define SF_GCC_ARM_BITFIELDS 2
 
 static PyObject *b_complete_struct_or_union(PyObject *self, PyObject *args)
 {
 #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",
             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;
                 do_align = fbitsize > 0;
             }
         }
-#endif
         if (alignment < falign && do_align)
             alignment = falign;