diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-07-25 13:01:24 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-25 13:01:24 (GMT) |
commit | 0cf5f6a6db0c50e46687de1fd99f90d7f85f69ea (patch) | |
tree | d4f2a8e724fb226a58832ebfad82acd14a3ac193 /Include | |
parent | fab36fb63eda4023097cb7f800d672ced26e338f (diff) | |
download | cpython-0cf5f6a6db0c50e46687de1fd99f90d7f85f69ea.zip cpython-0cf5f6a6db0c50e46687de1fd99f90d7f85f69ea.tar.gz cpython-0cf5f6a6db0c50e46687de1fd99f90d7f85f69ea.tar.bz2 |
[3.12] gh-105059: Use GCC/clang extension for PyObject union (GH-107232) (#107236)
gh-105059: Use GCC/clang extension for PyObject union (GH-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.
(cherry picked from commit 6261585d63a31835b65d445d99dc14cca3fe9cf5)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Include')
-rw-r--r-- | Include/object.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Include/object.h b/Include/object.h index 7564b96..542f8d8 100644 --- a/Include/object.h +++ b/Include/object.h @@ -165,6 +165,11 @@ check by comparing the reference count field to the immortality reference count. */ struct _object { _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 { Py_ssize_t ob_refcnt; #if SIZEOF_VOID_P > 4 |