[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
(ITS#9163) warning: logical not is only applied to the left hand side of bitwise operator
- To: openldap-its@OpenLDAP.org
- Subject: (ITS#9163) warning: logical not is only applied to the left hand side of bitwise operator
- From: noloader@gmail.com
- Date: Thu, 06 Feb 2020 09:01:33 +0000
- Auto-submitted: auto-generated (OpenLDAP-ITS)
Full_Name: Jeffrey Walton
Version: 2.4.47
OS: OS X 10.10
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (100.18.0.145)
Hi Everyone. I'm building OpenSLAP 2.4.47 from the release tarball on OS X.
Clang is triggering a warning that may be of interest:
gcc -g2 -O2 -march=native -fPIC -pthread -I../../include -I/usr/local/include
-DNDEBUG -c -o common.o common.c
...
common.c:2329:10: warning: logical not is only applied to the left hand side of
this bitwise operator [-Wlogical-not-parentheses]
if ( !tool_ctrl_response[j].mask & tool_type )
{
^ ~
common.c:2329:10: note: add parentheses after the '!' to evaluate the bitwise
operator first
if ( !tool_ctrl_response[j].mask & tool_type )
{
^
( )
common.c:2329:10: note: add parentheses around left hand side expression to
silence this warning
if ( !tool_ctrl_response[j].mask & tool_type )
{
^
( )
As written the statement is being evaluated as:
(!tool_ctrl_response[j].mask) & tool_type
It looks like this is what was intended:
!(tool_ctrl_response[j].mask & tool_type)
Perhaps the project can add parenthesis to clear the warning.