Issue 12604: VTRACE macro in _sre.c should use do {} while (0) (original) (raw)

Created on 2011-07-21 20:38 by joshtriplett, last changed 2022-04-11 14:57 by admin. 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) (Python triager) 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
2022-04-11 14:57:19 admin set github: 56813
2011-10-19 18:17:19 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: commit review -> resolved
2011-08-08 17:40:39 petri.lehtinen set messages: +
2011-08-08 15:22:01 eric.araujo set stage: patch review -> commit review
2011-08-08 15:20:58 eric.araujo set nosy: + eric.araujomessages: +
2011-07-23 10:17:23 petri.lehtinen set messages: +
2011-07-22 21:41:07 eric.araujo set components: + Extension Modules, - Library (Lib)versions: + Python 3.2, Python 3.3
2011-07-22 18:05:09 petri.lehtinen set keywords: + needs reviewcomponents: + Build, Library (Lib)stage: patch review
2011-07-22 18:04:15 petri.lehtinen set files: + fix_empty_macro.patchnosy: + petri.lehtinenmessages: + keywords: + patch
2011-07-21 20:38:13 joshtriplett create