Modify

Ticket #8034 (closed Patches: fixed)

Opened 14 months ago

Last modified 14 months ago

Warning fixes in multi_index

Reported by: Franz Detro <franz.detro@…> Owned by: joaquin
Milestone: To Be Determined Component: multi_index
Version: Boost 1.53.0 Severity: Cosmetic
Keywords: Cc:

Description

We have a zero warning policy in our development projects and experience lots of warnings in several boost libraries. With every new boost version we need to apply a set of warning fixes.

It would help a lot if you could integrate these warning fixes into future boost releases.

Please find attached a patch file against boost 1.53.0 which fixes several warnings in boost::multi_index.

Attachments

multi_index.diff Download (4.2 KB) - added by Franz Detro <franz.detro@…> 14 months ago.
boost_hashed_index.txt Download (11.2 KB) - added by Franz Detro <franz.detro@…> 14 months ago.

Change History

Changed 14 months ago by Franz Detro <franz.detro@…>

comment:1 Changed 14 months ago by joaquin

Hi Franz,

I fail to see how the patch (which just changes some variables names n, comp to np, comp_) can silent any warning --unless you're using preprocessor symbols with the same name or something. Can you describe these warnings in more detail?

comment:2 Changed 14 months ago by Franz Detro <franz.detro@…>

Hi,

it's a warning about a class member that gets hidden by a parameter or variable name (with clang on Mac / XCode 4.5).

Such issues might lead to hard-to-find bugs in the code, therefore this warning is enabled in our projects.

comment:3 Changed 14 months ago by joaquin

OK, I see. I'll fix this. Can you please run the whole Boost.MultiIndex test suite so as to locate all similar problems with the codebase? (There must be more of these, for instance in <boost/multi_index/hashed_index.hpp>)

Thank you,

Changed 14 months ago by Franz Detro <franz.detro@…>

comment:4 Changed 14 months ago by Franz Detro <franz.detro@…>

I've attached a compile log with the warnings. I didn't supply a fix, because these are exactly the kind of issues for which the warning is made for. For the non-maintainer (and maybe even for you) it's really hard to see which places need to be fixed and which not :

e.g. const CompatibleHash?& hash,const CompatiblePred?& eq)const

{

std::size_t buc=buckets.position(hash(k));

I guess the class CompatibleHash? has an operator () which creates a hash and I need to fix it here. But if this is not the case and hash(aValue) is a member of the class hashed_index, it probably shouldn't be fixed.

I didn't dig into the details, but maybe you understand that such code is *really* hard to read (and even harder to fix) for non-maintainers.

comment:5 Changed 14 months ago by joaquin

The warnings seems to correspond to test_composite_key.cpp only. Can you run the whole test suite so that we're sure we collect all warnings?

comment:6 Changed 14 months ago by Franz Detro <franz.detro@…>

The compilation of the other test files produced only duplicates of these warnings / warnings in other libraries (like the test framework). I'm pretty sure that we've collected all warnings in your code.

comment:7 Changed 14 months ago by joaquin

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

(In [82897]) fixed #8034

comment:8 Changed 14 months ago by joaquin

Franz, can you locally check that this clears your warnings? Thank you.

comment:9 Changed 14 months ago by Franz Detro <franz.detro@…>

Hi,

I've compiled our libraries against the current boost trunk, no multi_index warnings any longer.

Thank you very much!

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.