[PATCH] -Wno-parentheses-equality for Clang
Maxim Dounin
mdounin at mdounin.ru
Mon Jun 20 17:51:49 UTC 2016
Hello!
On Mon, Jun 20, 2016 at 03:43:12PM +0900, Taro KOBAYASHI wrote:
> > Fixing issue would be better than silencing the warning.
>
> I aggree with this. And looking into this problem more detail,
> I found that this is more complicated problem than simple coding
> style problem.
>
> in src/core/nginx.c:941:19
>
> 941| if (ngx_path_separator(*p)) {
> 942| cycle->conf_prefix.len = p - ngx_cycle->conf_file.data + 1;
> 943| cycle->conf_prefix.data = ngx_cycle->conf_file.data;
> 944| break;
> 945| }
>
> there is a macro ngx_path_separator defined in
>
> src/os/unix/ngx_files.h
> 201|#define ngx_path_separator(c) ((c) == '/')
>
> the warning is raised by the extraneous parentheses expanded by this
> macro. But generally we cannot say the parentheses in the macro is 'extraneous'
> as the situation could be changed by the context where it is used.
If some version of clang generates the warning for the code in
question, this looks like a bug in clang for me. Though I don't
see the warning generated at least by clang 3.4.1, 3.7.1, 3.8.0,
and 3.9.0 (trunk 271348), as well as with one shipped by Apple
(clang-703.0.31).
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list