Boost C++ Libraries: Ticket #3034: Boost::Parameter: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path https://svn.boost.org/trac10/ticket/3034 <p> I've recently added Boost to an Xcode 3.1.2 project with the following warnings enabled in GCC/G++ 4.0.1: </p> <blockquote> <p> -Werror -Wreturn-type -Wunused-function -Wunused-label -Wunused-variable -Wshadow </p> </blockquote> <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> <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> <p> The included headers this time are: </p> <blockquote> <p> boost/accumulators/accumulators.hpp boost/accumulators/statistics/stats.hpp boost/accumulators/statistics/rolling_mean.hpp </p> </blockquote> <p> To test and fix, I isolated with: </p> <blockquote> <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> </blockquote> <p> The patch to address this is as follows and impacts the headers below: </p> <blockquote> <p> boost/parameter/aux_/arg_list.hpp boost/parameter/aux_/maybe.hpp </p> </blockquote> <p> Patches for other headers to be filed separately. </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/3034 Trac 1.4.3 gerickson@… Fri, 15 May 2009 04:00:07 GMT attachment set https://svn.boost.org/trac10/ticket/3034 https://svn.boost.org/trac10/ticket/3034 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-03.patch</span> </li> </ul> <p> Patch for Boost::Parameter -Wshadow and -Wunused Errors </p> Ticket Marshall Clow Sat, 16 May 2009 15:34:43 GMT owner set https://svn.boost.org/trac10/ticket/3034#comment:1 https://svn.boost.org/trac10/ticket/3034#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Daniel Wallin</span> </li> </ul> Ticket Marshall Clow Sat, 16 May 2009 15:40:08 GMT component changed https://svn.boost.org/trac10/ticket/3034#comment:2 https://svn.boost.org/trac10/ticket/3034#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">parameter</span> </li> </ul> Ticket Daniel Wallin Fri, 29 May 2009 21:52:30 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3034#comment:3 https://svn.boost.org/trac10/ticket/3034#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</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/53414" title="Silence annoying GCC -Wshadow warnings. Fixes #3034. ">[53414]</a>) Silence annoying GCC -Wshadow warnings. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3034" title="#3034: Bugs: Boost::Parameter: Shadow Variables and Unused Globals Cause ... (closed: fixed)">#3034</a>. </p> Ticket