classification
Title: VTRACE macro in _sre.c should use do {} while (0)
Type: Stage: resolved
Components: Build, Extension Modules Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, joshtriplett, petri.lehtinen, python-dev
Priority: normal Keywords: needs review, patch

Created on 2011-07-21 20:38 by joshtriplett, last changed 2011-10-19 18:17 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
fix_empty_macro.patch petri.lehtinen, 2011-07-22 18:04
Messages (6)
msg140827 - (view) Author: Josh Triplett (joshtriplett) Date: 2011-07-21 20:38
In _sre.c, the VTRACE macro normally gets defined to nothing.  It later gets used as the body of control structures such as "else" without braces, which causes many compilers to warn (to catch stray semicolons like "else;").  This makes it difficult to compile Python as part of a project which uses -Werror, such as GRUB.  Please consider defining VTRACE as do {} while(0) instead, as the standard convention for an empty function-like macro with no return value.
msg140899 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-07-22 18:04
Attached a patch against 2.7 that adds the suggested fix.
msg140960 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-07-23 10:17
Should the component really be extension modules? I don't believe _sre.c is a part of the API, and the problem is embedding Python as a whole.
msg141786 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-08-08 15:20
_sre is a module written in C, not Python; we call that an extension module.  The Library component is used for Python modules, which are found in the Lib directory in a checkout of CPython.  See #12711.
msg141794 - (view) Author: Petri Lehtinen (petri.lehtinen) * (Python committer) Date: 2011-08-08 17:40
Éric Araujo wrote:
> _sre is a module written in C, not Python; we call that an extension
> module. The Library component is used for Python modules, which are
> found in the Lib directory in a checkout of CPython. See #12711.

Ok, I wasn't aware of this. Thanks.
msg145930 - (view) Author: Roundup Robot (python-dev) Date: 2011-10-19 18:17
New changeset f35514dfadf8 by Senthil Kumaran in branch '2.7':
Fix Issue 12604 - Use a proper no-op macro expansion for VTRACE macro in _sre.c
http://hg.python.org/cpython/rev/f35514dfadf8

New changeset ab028084f704 by Senthil Kumaran in branch '3.2':
3.2 - Fix Issue 12604 - Use a proper no-op macro expansion for VTRACE macro in _sre.c
http://hg.python.org/cpython/rev/ab028084f704

New changeset 847afc310190 by Senthil Kumaran in branch 'default':
default - Fix closes Issue 12604 - Use a proper no-op macro expansion for VTRACE macro in _sre.c
http://hg.python.org/cpython/rev/847afc310190
History
Date User Action Args
2011-10-19 18:17:19python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg145930

resolution: fixed
stage: commit review -> resolved
2011-08-08 17:40:39petri.lehtinensetmessages: + msg141794
2011-08-08 15:22:01eric.araujosetstage: patch review -> commit review
2011-08-08 15:20:58eric.araujosetnosy: + eric.araujo
messages: + msg141786
2011-07-23 10:17:23petri.lehtinensetmessages: + msg140960
2011-07-22 21:41:07eric.araujosetcomponents: + Extension Modules, - Library (Lib)
versions: + Python 3.2, Python 3.3
2011-07-22 18:05:09petri.lehtinensetkeywords: + needs review
components: + Build, Library (Lib)
stage: patch review
2011-07-22 18:04:15petri.lehtinensetfiles: + fix_empty_macro.patch

nosy: + petri.lehtinen
messages: + msg140899

keywords: + patch
2011-07-21 20:38:13joshtriplettcreate