Title: 'parentheses-equality' warnings when building with clang and ccache
Type: enhancement Stage: resolved
Components: Devguide Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, ezio.melotti, ncoghlan, python-dev, rhettinger, vstinner, willingc, xdegaye
Priority: normal Keywords: patch

Created on 2016-06-08 19:47 by xdegaye, last changed 2016-06-14 09:48 by xdegaye. This issue is now closed.

File name Uploaded Description Edit
clang_ccache.patch xdegaye, 2016-06-08 19:47
Messages (4)
msg267881 - (view) Author: Xavier de Gaye (xdegaye) * (Python triager) Date: 2016-06-08 19:47
Building Python with clang and ccache produces about 200 'parentheses-equality' warnings with the message:
    warning: equality comparison with extraneous parentheses [-Wparentheses-equality]

It seems that clang does not recognize that these extraneous parentheses are valid [1] after a macro expansion because the preprocessing is done as a separate stage by ccache.

[1] For example:
With the macros:
    #define Py_TYPE(ob)           (((PyObject*)(ob))->ob_type)
    #define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type)
The statement:
    if (PyLong_CheckExact(v))
is expanded to:
    if (((((PyObject*)(v))->ob_type) == &PyLong_Type))
and produces the warning with ccache.
msg267901 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2016-06-08 21:41
I like this suggestion.
msg268027 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-06-09 14:52
clang_ccache.patch LGTM.
msg268546 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-14 09:46
New changeset 18e960f930ab by Xavier de Gaye in branch 'default':
Issue #27270: `parentheses-equality` warnings when building with clang and ccache.
Date User Action Args
2016-06-14 09:48:02xdegayesetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-06-14 09:46:28python-devsetnosy: + python-dev
messages: + msg268546
2016-06-09 14:52:27vstinnersetnosy: + vstinner
messages: + msg268027
2016-06-08 21:41:50rhettingersetnosy: + rhettinger
messages: + msg267901
2016-06-08 19:47:43xdegayecreate