Opened 11 years ago

Closed 10 years ago

Last modified 10 years ago

#71 closed defect (fixed)

Various warnings with GCC

Reported by: alpar Owned by: somebody
Priority: major Component: component1
Version: 2.0 Keywords:
Cc:

Description

When using Cbc-2.2.2, GCC gives various warnings, e.g. a unused variable warnings:

In file included from /home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpPackedMatrix.hpp:8,
                 from /home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpModel.hpp:16,
                 from /home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpSimplex.hpp:15,
                 from lemon/clp.cc:20:
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpMatrixBase.hpp:101: warning: unused parameter 'model'
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpMatrixBase.hpp:101: warning: unused parameter 'baseModel'
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpMatrixBase.hpp:105: warning: unused parameter 'model'
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpMatrixBase.hpp:113: warning: unused parameter 'model'
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpMatrixBase.hpp:128: warning: unused parameter 'model'
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpMatrixBase.hpp:128: warning: unused parameter 'smallest'

...

and old-style cast warnings:

                 from lemon/clp.cc:20:
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinMessageHandler.hpp: In member function 'void CoinOneMessage::setDetail(int)':
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinMessageHandler.hpp:96: warning: use of old-style cast
In file included from /home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpModel.hpp:18,
                 from /home/alpar/download/coin-or/Cbc-2.2.2/include/coin/ClpSimplex.hpp:15,
                 from lemon/clp.cc:20:
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinHelperFunctions.hpp: In function 'char* CoinStrdup(const char*)':
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinHelperFunctions.hpp:497: warning: use of old-style cast
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinHelperFunctions.hpp: In function 'double CoinDrand48(bool, unsigned int)':
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinHelperFunctions.hpp:732: warning: use of old-style cast
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinHelperFunctions.hpp: In member function 'double CoinThreadRandom::randomDouble() const':
/home/alpar/download/coin-or/Cbc-2.2.2/include/coin/CoinHelperFunctions.hpp:923: warning: use of old-style cast

...

Change History (5)

comment:2 follow-up: Changed 10 years ago by forrest

  • Resolution set to invalid
  • Status changed from new to closed

I claim unused warnings are a defect in compiler. These are virtual methods. Just because a parameter is not used in one instantiation, it still has to be in.

cast stuff is fixed in new stable

comment:3 in reply to: ↑ 2 Changed 10 years ago by alpar

  • Resolution invalid deleted
  • Status changed from closed to reopened

Replying to forrest:

I claim unused warnings are a defect in compiler.

Even if it were true, it should be fixed, because it is very annoying when using the library, and it is also dangerous because the lot irrelevant warnings may hide the real one.

But actually it is the intended behavior of the compiler.

These are virtual methods. Just because a parameter is not used in one instantiation, it still has to be in.

The solution for this is to simply omit the name of the unused parameters, e.g. write

virtual int scale(ClpModel *, const ClpSimplex * baseModel=NULL) const

instead of

virtual int scale(ClpModel * model, const ClpSimplex * baseModel=NULL) const

Btw. Somehow I didn't get any notification about the update of this ticket. Where shall I report this?

comment:4 Changed 10 years ago by forrest

  • Resolution set to fixed
  • Status changed from reopened to closed

I have taken out some parameters but as I don't know which option gives warnings can't really test. Also can't see how to get rid of warning for smallest.

comment:5 Changed 10 years ago by stefan

See also https://projects.coin-or.org/Clp/ticket/30 for parameter "smallest".

Note: See TracTickets for help on using tickets.