mirror of
https://github.com/python/cpython.git
synced 2025-12-10 19:10:59 +00:00
gh-105059: Use GCC/clang extension for PyObject union (#107232)
Anonymous union is new in C11. To prevent compiler warning when using -pedantic compiler option, use Clang and GCC extension on C99 and older.
This commit is contained in:
parent
2425346fee
commit
6261585d63
1 changed files with 5 additions and 0 deletions
|
|
@ -165,6 +165,11 @@ 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__)) \
|
||||||
|
&& !(defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L)
|
||||||
|
// On C99 and older, anonymous union is a GCC and clang extension
|
||||||
|
__extension__
|
||||||
|
#endif
|
||||||
union {
|
union {
|
||||||
Py_ssize_t ob_refcnt;
|
Py_ssize_t ob_refcnt;
|
||||||
#if SIZEOF_VOID_P > 4
|
#if SIZEOF_VOID_P > 4
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue