Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler error in gvm-libs/base/networking.c due to extra parentheses #434

Closed
rpfeiffer opened this issue Feb 5, 2021 · 3 comments
Closed
Labels

Comments

@rpfeiffer
Copy link

rpfeiffer commented Feb 5, 2021

When compiling the gvm-libs branch (master and 20.8.x) the compiler reports the error "equality comparison with extraneous parentheses". Due to the -Werror flag set the warning is turned into an error and the compilation does not finish

Expected behavior

Expectation is to finish the build process.

Actual behavior

Compilation stops with:

/tmp/gvm-libs/base/networking.c:654:27: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
if ((element[0] == 'T'))
~~~~~~~~~~~^~~~~~
/tmp/gvm-libs/base/networking.c:654:27: note: remove extraneous parentheses around the comparison to silence this warning
if ((element[0] == 'T'))
~ ^ ~
/tmp/gvm-libs/base/networking.c:654:27: note: use '=' to turn this equality comparison into an assignment
if ((element[0] == 'T'))
^~
=
/tmp/gvm-libs/base/networking.c:665:32: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
else if ((element[0] == 'U'))
~~~~~~~~~~~^~~~~~
/tmp/gvm-libs/base/networking.c:665:32: note: remove extraneous parentheses around the comparison to silence this warning
else if ((element[0] == 'U'))
~ ^ ~
/tmp/gvm-libs/base/networking.c:665:32: note: use '=' to turn this equality comparison into an assignment
else if ((element[0] == 'U'))
^~
=
2 errors generated.

Steps to reproduce

  1. git clone https://github.com/greenbone/gvm-libs.git
  2. cd gvm-libs/
  3. export CC=clang-12
  4. export CXX=clang++-12
  5. mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=/opt/gvm .. && make && make doc

GVM versions

Since gvm-libs is the first package to install, there are no installed versions.

Environment

Operating system:

Fix

Remove the extraneous parentheses in the following files:

  • gvm-libs/base/networking.c:654:27
  • gvm-libs/base/networking.c:665:32

After removing the extraneous parentheses the code compiles successfully.

@rpfeiffer rpfeiffer added the bug label Feb 5, 2021
@y0urself
Copy link
Member

y0urself commented Feb 6, 2021

Do you want to provide a PR yourself?

@rpfeiffer
Copy link
Author

No, I just want to create a deployment playbook to install OpenVAS by using Ansible. Compiler errors tend to break automatisation. I used no special compile options to check the code for errors, i.e. I did not activate "-Werror,-Wparentheses-equality" on purpose. I just happen to use Clang 12 at the moment.

@y0urself
Copy link
Member

y0urself commented Feb 6, 2021

This message also appears for clang-7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants