[New-bugs-announce] [issue24655] _ssl.c: Missing "do" for do {} while(0) idiom

Brian Cain report at bugs.python.org
Sat Jul 18 00:32:24 CEST 2015


New submission from Brian Cain:

_ssl.c has a "convert()" macro which misuses the "do { ... } while(0)" pattern by accidentally omitting the "do".

This was discovered when building with clang, it reports "while loop has empty body".  Effectively, convert puts the body into gratuitous scope braces and happens to be followed by a "while(0);".  If convert() were used in some context where it weren't followed by a semicolon, it might do something terribly interesting.  Or, more likely, just fail to build.

----------
components: Extension Modules
files: ssl_convert.patch
keywords: patch
messages: 246868
nosy: Brian.Cain
priority: normal
severity: normal
status: open
title: _ssl.c: Missing "do" for do {} while(0) idiom
versions: Python 3.6
Added file: http://bugs.python.org/file39938/ssl_convert.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24655>
_______________________________________


More information about the New-bugs-announce mailing list