8000 [3.12] gh-105059: Use GCC/clang extension for PyObject union (GH-107232) by miss-islington · Pull Request #107236 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.12] gh-105059: Use GCC/clang extension for PyObject union (GH-107232) #107236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 6261585)

Co-authored-by: Victor Stinner <vstinner@python.org>
  • Loading branch information
vstinner authored and miss-islington committed Jul 25, 2023
commit 627d528c62755b9cd130206d04cdafe7f262c7f8
5 changes: 5 additions & 0 deletions Include/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
0