You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clang warns "warning: redefinition of typedef 'PyTypeObject' is a C11 feature [-Wtypedef-redefinition]" #83752
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2020-02-07.00:49:45.257>created_at=<Date2020-02-06.17:09:38.996>labels= ['expert-C-API', '3.9']
title='clang warns "warning: redefinition of typedef \'PyTypeObject\' is a C11 feature [-Wtypedef-redefinition]"'updated_at=<Date2020-02-07.00:49:45.256>user='https://github.com/colesbury'
Sorry, I only tested GCC and I forgot that clang is more pedantic on duplicated typedef. I looked better with PyTypeObject, but the fix is easy: just revert my change: PR 18384.
Oh, nice! I proposed PR 18385. Would you mind to confirm that it fix the issue for you? At least, I tested manually and the clang warning goes away with this change.
Activity
colesbury commentedon Feb 6, 2020
A recent commit added a typedef for PyTypeObject in Include/object.h
0e4e735
This duplicates the typedef in Include/cpython/object.h. Building with clang now issues a warning:
./Include/cpython/object.h:274:3: warning: redefinition of typedef 'PyTypeObject' is a C11 feature [-Wtypedef-redefinition]
This is due to the combination of
-Walland-std=c99. GCC will only warn if the-pedanticoption is specified.vstinner commentedon Feb 6, 2020
Sorry, I only tested GCC and I forgot that clang is more pedantic on duplicated typedef. I looked better with PyTypeObject, but the fix is easy: just revert my change: PR 18384.
colesbury commentedon Feb 6, 2020
Alternatively I think you can just remove the typedef from Include/cpython/object.h since Include/object.h is always included first. i.e.:
to simply
vstinner commentedon Feb 6, 2020
Oh, nice! I proposed PR 18385. Would you mind to confirm that it fix the issue for you? At least, I tested manually and the clang warning goes away with this change.
colesbury commentedon Feb 6, 2020
Yes, that fixes the warnings for me. Thanks!
vstinner commentedon Feb 7, 2020
New changeset f95cd19 by Victor Stinner in branch 'master':
bpo-39571: Fix clang warning on PyTypeObject typedef (GH-18385)
f95cd19
vstinner commentedon Feb 7, 2020
Thanks Sam Gross for the hint, it's now fixed.