classification
Title: Not all enumerations used in _Py_ANNOTATE_MEMORY_ORDER
Type: compile error Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: flub, petri.lehtinen, python-dev
Priority: normal Keywords: needs review, patch

Created on 2011-11-04 00:24 by flub, last changed 2011-11-19 20:12 by petri.lehtinen. This issue is now closed.

Files
File name Uploaded Description Edit
pyatomic.diff flub, 2011-11-06 11:33 review
Messages (4)
msg146993 - (view) Author: Floris Bruynooghe (flub) Date: 2011-11-04 00:24
Hi,

When compiling using gcc and -Werror=switch-enum the compilation fails, e.g. while compiling an extension module:

In file included from /usr/include/python3.2mu/Python.h:52:0,
                 from src/util.c:27:
/usr/include/python3.2mu/pyatomic.h: In function ‘_Py_ANNOTATE_MEMORY_ORDER’:
/usr/include/python3.2mu/pyatomic.h:61:5: error: enumeration value ‘_Py_memory_order_relaxed’ not handled in switch [-Werror=switch-enum]
/usr/include/python3.2mu/pyatomic.h:61:5: error: enumeration value ‘_Py_memory_order_acquire’ not handled in switch [-Werror=switch-enum]
/usr/include/python3.2mu/pyatomic.h:70:5: error: enumeration value ‘_Py_memory_order_relaxed’ not handled in switch [-Werror=switch-enum]
/usr/include/python3.2mu/pyatomic.h:70:5: error: enumeration value ‘_Py_memory_order_release’ not handled in switch [-Werror=switch-enum]

This could be easily resolved without any drawbacks by simply listing the missing enumeration items together with the default.  And that would enable extensions to be built using -Werror=switch-enum again.

Regards,
Floris
msg147152 - (view) Author: Floris Bruynooghe (flub) Date: 2011-11-06 11:33
Apologies for not attaching a patch, I thought it was pretty trivial.  Attached it now.
msg147967 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-11-19 20:11
New changeset f855f929bc48 by Petri Lehtinen in branch '3.2':
Issue #13338: Handle all enumerations in _Py_ANNOTATE_MEMORY_ORDER
http://hg.python.org/cpython/rev/f855f929bc48

New changeset c2e588a5237a by Petri Lehtinen in branch 'default':
Merge branch 3.2 (closes #13338)
http://hg.python.org/cpython/rev/c2e588a5237a
msg147968 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-11-19 20:12
Your patch was applied with the default: case removed. Thanks!
History
Date User Action Args
2011-11-19 20:12:55petri.lehtinensetmessages: + msg147968
2011-11-19 20:11:09python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg147967

resolution: fixed
stage: patch review -> resolved
2011-11-06 11:50:36petri.lehtinensetkeywords: + needs review
stage: needs patch -> patch review
2011-11-06 11:33:23flubsetfiles: + pyatomic.diff
keywords: + patch
messages: + msg147152
2011-11-05 19:48:34petri.lehtinensetnosy: + petri.lehtinen
2011-11-05 19:48:24petri.lehtinensetstage: needs patch
2011-11-04 00:24:43flubcreate