Kaydet (Commit) e1448730 authored tarafından Thomas Heller's avatar Thomas Heller

Fix issue #3547 for MingW, update comments.

üst eb257ac9
...@@ -223,8 +223,9 @@ class BitFieldTest(unittest.TestCase): ...@@ -223,8 +223,9 @@ class BitFieldTest(unittest.TestCase):
("d", c_short, 4), ("d", c_short, 4),
("e", c_short, 4), ("e", c_short, 4),
("f", c_int, 24)] ("f", c_int, 24)]
# MS compilers do NOT combine c_short and c_int into # MSVC does NOT combine c_short and c_int into one field, GCC
# one field, gcc does. # does (unless GCC is run with '-mms-bitfields' which
# produces code compatible with MSVC).
if os.name in ("nt", "ce"): if os.name in ("nt", "ce"):
self.failUnlessEqual(sizeof(X), sizeof(c_int) * 4) self.failUnlessEqual(sizeof(X), sizeof(c_int) * 4)
else: else:
......
...@@ -65,10 +65,12 @@ CField_FromDesc(PyObject *desc, Py_ssize_t index, ...@@ -65,10 +65,12 @@ CField_FromDesc(PyObject *desc, Py_ssize_t index,
} }
if (bitsize /* this is a bitfield request */ if (bitsize /* this is a bitfield request */
&& *pfield_size /* we have a bitfield open */ && *pfield_size /* we have a bitfield open */
#if defined(MS_WIN32) && !defined(__MINGW32__) #ifdef MS_WIN32
&& dict->size * 8 == *pfield_size /* MSVC */ /* MSVC, GCC with -mms-bitfields */
&& dict->size * 8 == *pfield_size
#else #else
&& dict->size * 8 <= *pfield_size /* GCC, MINGW */ /* GCC */
&& dict->size * 8 <= *pfield_size
#endif #endif
&& (*pbitofs + bitsize) <= *pfield_size) { && (*pbitofs + bitsize) <= *pfield_size) {
/* continue bit field */ /* continue bit field */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment