Boost C++ Libraries: Ticket #3262: Boost::Accumulators::Statistics: Unused Globals Cause Warnings/Errors When Headers Are Not in System Path https://svn.boost.org/trac10/ticket/3262 <p> 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: </p> <p> -Werror -Wreturn-type -Wunused-function -Wunused-label -Wunused-variable -Wshadow </p> <p> 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: </p> <blockquote> <p> <a class="ext-link" href="http://article.gmane.org/gmane.comp.lib.boost.user/38297/match=shadow+variables+cause"><span class="icon">​</span>http://article.gmane.org/gmane.comp.lib.boost.user/38297/match=shadow+variables+cause</a> </p> </blockquote> <p> The included headers this time are: </p> <p> boost/accumulators/statistics/mean.hpp boost/accumulators/statistics/sum.hpp </p> <p> To test and fix, I isolated with: </p> <p> printf "#include &lt;${<a class="missing wiki">BoostHeader</a>}&gt;\nint main(void) { return 0; }" | /Developer/usr/bin/gcc-4.0 -x c++ -Wall -Wshadow -Werror -o test -I${<a class="missing wiki">BoostRoot</a>}/boost/include - </p> <p> The patches to address this are attached and impact the headers below: </p> <p> boost/accumulators/statistics/mean.hpp boost/accumulators/statistics/sum.hpp </p> <p> Because this problem seems to come up frequently, perhaps there is a way -Wshadow and -Wall can be forced for all unit tests? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3262 Trac 1.4.3 gerickson@… Tue, 14 Jul 2009 02:25:10 GMT attachment set https://svn.boost.org/trac10/ticket/3262 https://svn.boost.org/trac10/ticket/3262 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-02.patch</span> </li> </ul> <p> Patch for Boost::Accumulators::Statistics::sum -Wshadow and -Wunused Errors </p> Ticket gerickson@… Tue, 14 Jul 2009 02:25:34 GMT attachment set https://svn.boost.org/trac10/ticket/3262 https://svn.boost.org/trac10/ticket/3262 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-03.patch</span> </li> </ul> <p> Patch for Boost::Accumulators::Statistics::mean -Wshadow and -Wunused Errors </p> Ticket Eric Niebler Mon, 20 Jul 2009 21:24:17 GMT status changed https://svn.boost.org/trac10/ticket/3262#comment:1 https://svn.boost.org/trac10/ticket/3262#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> Ticket Eric Niebler Mon, 20 Jul 2009 23:05:00 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3262#comment:2 https://svn.boost.org/trac10/ticket/3262#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/55050" title="eliminate shadow warnings and unused variable warnings, fixes #3262, ...">[55050]</a>) eliminate shadow warnings and unused variable warnings, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3262" title="#3262: Bugs: Boost::Accumulators::Statistics: Unused Globals Cause Warnings/Errors ... (closed: fixed)">#3262</a>, fixed <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3276" title="#3276: Bugs: Boost::Accumulators::Statistics: Unused Variables and Globals Cause ... (closed: fixed)">#3276</a>, fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3031" title="#3031: Bugs: Boost::Accumulators: Shadow Variables and Unused Globals Cause ... (closed: fixed)">#3031</a> </p> Ticket