[Cbc] Compiler warning flags
Alpár Jüttner
alpar at cs.elte.hu
Fri Apr 29 11:13:26 EDT 2011
Hi,
I made an attempt to weed out compilation warnings from Cbc using strict
warning flags with gcc 4.5.2. Please find the result in the attached
patches. They are against SVN version -r1638 of Cbc trunk. They contain
modifications of projects Cbc, Cgl, Clp, CoinUtils and Osi.
I tried to remove the warnings that appeared using the following
configuration of Cbc:
./configure ADD_CXXFLAGS="-W -Wunused -Wctor-dtor-privacy
-Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings
-Wno-char-subscripts -Wcast-align -Wsign-promo -Woverloaded-virtual
-fno-strict-aliasing -Wold-style-cast"
The resulting patches contain the following changes:
* Every appearance of DBL_MAX was replaced by COIN_DBL_MAX.
* All the multiple definitions of COIN_DBL_MAX have been removed
except for the one in CoinUtils/src/CoinFinite.hpp.
* The definition of COIN_DBL_MAX has been changed. Now it is a
'const double' instead of a #define, and it is defined using
#include<limits>.
* DBL_MAX does not really conform C++ and produces
old-style cast warnings.
* The use of #define is discouraged in C++, whenever
possible.
* I also defined COIN_DBL_MIN in the same way and replaced DBL_MIN
to this.
* Similar changes have been made to COIN_INT_MAX. It became a
'const int' and it is defined using #include<limits> instead of
bit operations.
* The `unused parameter` warnings were resolved by removing their
names from the declaration.
* Finally, I weeded out all the old-style casts from the code.
There are some warnings that still remained in the code, which I
couldn't fix because of my poor knowledge of Cbc internals:
* There are a couple of `comparison between signed and unsigned
integer expressions` warnings CbcOrClpParam.cpp. (I couldn't
figure out if I should convert them to `int` or `unsigned int`.)
* There are a lot of `virtual function X was hidden by Y` warnings
at several places. They are indeed looks quite suspicious, thus
should really be investigated by someone.
All the best,
Alpar
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cbc-warn.patch
Type: text/x-patch
Size: 7875 bytes
Desc: not available
Url : http://list.coin-or.org/pipermail/cbc/attachments/20110429/e5e8a8e4/attachment-0005.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cgl-warn.patch
Type: text/x-patch
Size: 26164 bytes
Desc: not available
Url : http://list.coin-or.org/pipermail/cbc/attachments/20110429/e5e8a8e4/attachment-0006.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clp-warn.patch
Type: text/x-patch
Size: 536 bytes
Desc: not available
Url : http://list.coin-or.org/pipermail/cbc/attachments/20110429/e5e8a8e4/attachment-0007.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coinutils-warn.patch
Type: text/x-patch
Size: 4121 bytes
Desc: not available
Url : http://list.coin-or.org/pipermail/cbc/attachments/20110429/e5e8a8e4/attachment-0008.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: osi-warn.patch
Type: text/x-patch
Size: 10069 bytes
Desc: not available
Url : http://list.coin-or.org/pipermail/cbc/attachments/20110429/e5e8a8e4/attachment-0009.bin
More information about the Cbc
mailing list