1. Armin Rigo
  2. cpython-withatomic

Commits

Thomas Heller  committed 5b35294

Fix issue #3547 for MingW, update comments.

  • Participants
  • Parent commits 40536dd
  • Branches legacy-trunk

Comments (0)

Files changed (2)

File Lib/ctypes/test/test_bitfields.py

View file
                         ("d", c_short, 4),
                         ("e", c_short, 4),
                         ("f", c_int, 24)]
-        # MS compilers do NOT combine c_short and c_int into
-        # one field, gcc does.
+        # MSVC does NOT combine c_short and c_int into one field, GCC
+        # does (unless GCC is run with '-mms-bitfields' which
+        # produces code compatible with MSVC).
         if os.name in ("nt", "ce"):
             self.failUnlessEqual(sizeof(X), sizeof(c_int) * 4)
         else:

File Modules/_ctypes/cfield.c

View file
 	}
 	if (bitsize /* this is a bitfield request */
 	    && *pfield_size /* we have a bitfield open */
-#if defined(MS_WIN32) && !defined(__MINGW32__)
-	    && dict->size * 8 == *pfield_size /* MSVC */
+#ifdef MS_WIN32
+	    /* MSVC, GCC with -mms-bitfields */
+	    && dict->size * 8 == *pfield_size
 #else
-	    && dict->size * 8 <= *pfield_size /* GCC, MINGW */
+	    /* GCC */
+	    && dict->size * 8 <= *pfield_size 
 #endif
 	    && (*pbitofs + bitsize) <= *pfield_size) {
 		/* continue bit field */