Boost C++ Libraries: Ticket #3032: Boost:: Circular_Buffer: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path https://svn.boost.org/trac10/ticket/3032 <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/circular_buffer/base.hpp boost/circular_buffer/details.hpp boost/circular_buffer/space_optimized.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/3032 Trac 1.4.3 gerickson@… Fri, 15 May 2009 03:54:31 GMT attachment set https://svn.boost.org/trac10/ticket/3032 https://svn.boost.org/trac10/ticket/3032 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-01.patch</span> </li> </ul> <p> Patch for Boost::Fusion -Wshadow and -Wunused Errors </p> Ticket gerickson@… Fri, 15 May 2009 03:57:08 GMT <link>https://svn.boost.org/trac10/ticket/3032#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3032#comment:1</guid> <description> <p> Unfortunately, I fouled up the patch description and bug description. This is for Boost::Circular_Buffer, not Boost::Fusion. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Sat, 16 May 2009 15:36:10 GMT</pubDate> <title>summary changed; owner set https://svn.boost.org/trac10/ticket/3032#comment:2 https://svn.boost.org/trac10/ticket/3032#comment:2 <ul> <li><strong>owner</strong> set to <span class="trac-author">Jan Gaspar</span> </li> <li><strong>summary</strong> <span class="trac-field-old">Boost::Fusion: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path</span> → <span class="trac-field-new">Boost:: Circular_Buffer: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path</span> </li> </ul> Ticket Marshall Clow Sat, 16 May 2009 15:39:13 GMT component changed https://svn.boost.org/trac10/ticket/3032#comment:3 https://svn.boost.org/trac10/ticket/3032#comment:3 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">circular_buffer</span> </li> </ul> Ticket Jan Gaspar Mon, 25 May 2009 22:10:40 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3032#comment:4 https://svn.boost.org/trac10/ticket/3032#comment:4 <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">duplicate</span> </li> </ul> Ticket Jan Gaspar Mon, 25 May 2009 22:13:04 GMT <link>https://svn.boost.org/trac10/ticket/3032#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3032#comment:5</guid> <description> <p> duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/2785" title="#2785: Patches: [patch] GCC Shadow errors in circular buffer (closed: fixed)">#2785</a> </p> </description> <category>Ticket</category> </item> </channel> </rss>