gh-105059: Fix MSCV compiler warning on PyObject union (#107239)
Use pragma to ignore the MSCV compiler warning on the PyObject nameless union.
This commit is contained in:
parent
1a3faba9f1
commit
1c8fe9bdb6
@ -165,10 +165,17 @@ check by comparing the reference count field to the immortality reference count.
|
|||||||
*/
|
*/
|
||||||
struct _object {
|
struct _object {
|
||||||
_PyObject_HEAD_EXTRA
|
_PyObject_HEAD_EXTRA
|
||||||
|
|
||||||
#if (defined(__GNUC__) || defined(__clang__)) \
|
#if (defined(__GNUC__) || defined(__clang__)) \
|
||||||
&& !(defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)
|
&& !(defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)
|
||||||
// On C99 and older, anonymous union is a GCC and clang extension
|
// On C99 and older, anonymous union is a GCC and clang extension
|
||||||
__extension__
|
__extension__
|
||||||
|
#endif
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Ignore MSC warning C4201: "nonstandard extension used:
|
||||||
|
// nameless struct/union"
|
||||||
|
__pragma(warning(push))
|
||||||
|
__pragma(warning(disable: 4201))
|
||||||
#endif
|
#endif
|
||||||
union {
|
union {
|
||||||
Py_ssize_t ob_refcnt;
|
Py_ssize_t ob_refcnt;
|
||||||
@ -176,6 +183,10 @@ struct _object {
|
|||||||
PY_UINT32_T ob_refcnt_split[2];
|
PY_UINT32_T ob_refcnt_split[2];
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
__pragma(warning(pop))
|
||||||
|
#endif
|
||||||
|
|
||||||
PyTypeObject *ob_type;
|
PyTypeObject *ob_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user