lsils/mockturtle

compile warnings: -Werror=unused-but-set-variable

fabrizioferrandi opened this issue · 4 comments

Hi
I found some possible issues in the code.

In Solver::addClause_ variable flag is set but not used. Is this intended?

Lit p; int i, j, flag = 0;

In Solver::simplifyLearnt variables beforeSize and afterSize are set but not used. There were used when the printf was active.

int beforeSize, afterSize;

All these warnings come when option -Werror=unused-but-set-variable is passed to gcc compiler.
Cheers,
Fabrizio

These solver headers are third-party code for us, that we do not maintain.

How to reproduce your problem?

I tried it as follows and it seems to compile on my computer:

$ git clone https://github.com/lsils/mockturtle.git
$ cd mockturtle
$ mkdir build
$ cd build
$ cmake -DCMAKE_CXX_COMPILER=/usr/local/bin/gcc-10 -DCMAKE_CXX_FLAGS_DEBUG="-Werror=unused-but-set-variable" -DCMAKE_BUILD_TYPE=DEBUG -DMOCKTURTLE_TEST=ON ..
$ make

Please also ensure that bill has been included as a system header in your version:
https://github.com/lsils/mockturtle/blob/master/lib/CMakeLists.txt#L55

Hi,
I tend to compile with -Wall -Wextra -Werror plus additional warning not enabled by default.
This is the complete list:

-Wall -Werror -Wextra -Wconversion -Wno-deprecated -Winit-self -Wsign-conversion -Wredundant-decls -Wvla -Wshadow -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Winit-self -Wpointer-arith -Wcast-qual -Wcast-align -Wdouble-promotion -Wold-style-cast -Wno-error=old-style-cast -Wsign-promo -Wswitch-enum -Wswitch-default -Wundef -Wno-unknown-pragmas -Wmissing-include-dirs -Wlogical-op -Wunused-local-typedefs -Wzero-as-null-pointer-constant -Wno-error=zero-as-null-pointer-constant -Wpedantic -Wno-overlength-strings -Wno-deprecated-copy -Wno-error=deprecated-copy -Wno-unused-but-set-parameter -Wno-error=unused-but-set-parameter

I tried to pass to cmake such options but I was not able to reproduce the issue either. I'm not an expert of cmake.

Such parameters are passed to an autotools based build system. Currently, the code is only on a local branch so it is difficult to show how I use sat lut mapping. A version based on an older mockturtle version is available here: link

Anyway, the issues pointed by my building system are correct so I open the issue.
Cheers,
Fabrizio

Our CMake build system treats bill as an external project and, consequently, does not report warnings from bill.

I assume the problem could be solved in autotools in a similar way. You could include the headers of mockturtle, bill, etc. (all the libraries that are not under your control) with -isystem instead of -I.

You are right. I changed the -I in -isystem where needed and now our building system behave as cmake.
Thank you very much for the suggestion.
Cheers,
Fabrizio