Opened 13 years ago

Closed 13 years ago

#3262 closed Bugs (fixed)

Boost::Accumulators::Statistics: Unused Globals Cause Warnings/Errors When Headers Are Not in System Path

Reported by: gerickson@… Owned by: Eric Niebler
Milestone: To Be Determined Component: accumulator
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

I've recently added Boost 1.39.0 to an Xcode 3.1.3 project with the following warnings enabled in GCC/G++ 4.0.1:

-Werror -Wreturn-type -Wunused-function -Wunused-label -Wunused-variable -Wshadow

Unfortunately, when boost is not installed in a "system" path--as is the case here--unused and shadow variable warnings cause the build to fail when warnings are treated as errors. This issue last came up for me about a year ago in 1_35_0 with filesystem.hpp:

http://article.gmane.org/gmane.comp.lib.boost.user/38297/match=shadow+variables+cause

The included headers this time are:

boost/accumulators/statistics/mean.hpp boost/accumulators/statistics/sum.hpp

To test and fix, I isolated with:

printf "#include <${BoostHeader}>\nint main(void) { return 0; }" | /Developer/usr/bin/gcc-4.0 -x c++ -Wall -Wshadow -Werror -o test -I${BoostRoot}/boost/include -

The patches to address this are attached and impact the headers below:

boost/accumulators/statistics/mean.hpp boost/accumulators/statistics/sum.hpp

Because this problem seems to come up frequently, perhaps there is a way -Wshadow and -Wall can be forced for all unit tests?

Attachments (2)

boost-02.patch (609 bytes ) - added by gerickson@… 13 years ago.
Patch for Boost::Accumulators::Statistics::sum -Wshadow and -Wunused Errors
boost-03.patch (529 bytes ) - added by gerickson@… 13 years ago.
Patch for Boost::Accumulators::Statistics::mean -Wshadow and -Wunused Errors

Download all attachments as: .zip

Change History (4)

by gerickson@…, 13 years ago

Attachment: boost-02.patch added

Patch for Boost::Accumulators::Statistics::sum -Wshadow and -Wunused Errors

by gerickson@…, 13 years ago

Attachment: boost-03.patch added

Patch for Boost::Accumulators::Statistics::mean -Wshadow and -Wunused Errors

comment:1 by Eric Niebler, 13 years ago

Status: newassigned

comment:2 by Eric Niebler, 13 years ago

Resolution: fixed
Status: assignedclosed

(In [55050]) eliminate shadow warnings and unused variable warnings, fixes #3262, fixed #3276, fixes #3031

Note: See TracTickets for help on using tickets.