#3032 closed Bugs (duplicate)
Boost:: Circular_Buffer: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path
Reported by: | Owned by: | Jan Gaspar | |
---|---|---|---|
Milestone: | Boost 1.40.0 | Component: | circular_buffer |
Version: | Boost 1.39.0 | Severity: | Problem |
Keywords: | Cc: |
Description
I've recently added Boost to an Xcode 3.1.2 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/accumulators.hpp boost/accumulators/statistics/stats.hpp boost/accumulators/statistics/rolling_mean.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 patch to address this is as follows and impacts the headers below:
boost/circular_buffer/base.hpp boost/circular_buffer/details.hpp boost/circular_buffer/space_optimized.hpp
Patches for other headers to be filed separately.
Because this problem seems to come up frequently, perhaps there is a way -Wshadow and -Wall can be forced for all unit tests?
Attachments (1)
Change History (6)
by , 13 years ago
Attachment: | boost-01.patch added |
---|
comment:1 by , 13 years ago
Unfortunately, I fouled up the patch description and bug description. This is for Boost::Circular_Buffer, not Boost::Fusion.
comment:2 by , 13 years ago
Owner: | set to |
---|---|
Summary: | Boost::Fusion: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path → Boost:: Circular_Buffer: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path |
comment:3 by , 13 years ago
Component: | None → circular_buffer |
---|
comment:4 by , 13 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Patch for Boost::Fusion -Wshadow and -Wunused Errors