Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8034 closed Patches (fixed)

Warning fixes in multi_index

Reported by: Franz Detro <franz.detro@…> Owned by: Joaquín M López Muñoz
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 (2)

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

Download all attachments as: .zip

Change History (11)

by Franz Detro <franz.detro@…>, 10 years ago

Attachment: multi_index.diff added

comment:1 by Joaquín M López Muñoz, 10 years ago

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 by Franz Detro <franz.detro@…>, 10 years ago

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 by Joaquín M López Muñoz, 10 years ago

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,

by Franz Detro <franz.detro@…>, 10 years ago

Attachment: boost_hashed_index.txt added

comment:4 by Franz Detro <franz.detro@…>, 10 years ago

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 by Joaquín M López Muñoz, 10 years ago

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 by Franz Detro <franz.detro@…>, 10 years ago

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 by Joaquín M López Muñoz, 10 years ago

Resolution: fixed
Status: newclosed

(In [82897]) fixed #8034

comment:8 by Joaquín M López Muñoz, 10 years ago

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

comment:9 by Franz Detro <franz.detro@…>, 10 years ago

Hi,

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

Thank you very much!

Note: See TracTickets for help on using tickets.