Boost C++ Libraries: Ticket #3033: Boost::Fusion: Shadow Variables and Unused Globals Cause Warnings/Errors When Headers Are Not in System Path https://svn.boost.org/trac10/ticket/3033 <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/fusion/container/list/cons.hpp boost/fusion/container/list/cons_iterator.hpp boost/fusion/container/vector/vector_iterator.hpp boost/fusion/view/filter_view/filter_view.hpp boost/fusion/view/filter_view/filter_view_iterator.hpp boost/fusion/view/iterator_range/iterator_range.hpp boost/fusion/view/joint_view/joint_view.hpp boost/fusion/view/joint_view/joint_view_iterator.hpp boost/fusion/view/single_view/single_view.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/3033 Trac 1.4.3 gerickson@… Fri, 15 May 2009 03:58:39 GMT attachment set https://svn.boost.org/trac10/ticket/3033 https://svn.boost.org/trac10/ticket/3033 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-02.patch</span> </li> </ul> <p> Patch for Boost::Fusion -Wshadow and -Wunused Errors </p> Ticket Marshall Clow Sat, 16 May 2009 15:36:33 GMT owner set https://svn.boost.org/trac10/ticket/3033#comment:1 https://svn.boost.org/trac10/ticket/3033#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Joel de Guzman</span> </li> </ul> Ticket Marshall Clow Sat, 16 May 2009 15:40:18 GMT component changed https://svn.boost.org/trac10/ticket/3033#comment:2 https://svn.boost.org/trac10/ticket/3033#comment:2 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fusion</span> </li> </ul> Ticket anonymous Sat, 16 May 2009 15:42:56 GMT <link>https://svn.boost.org/trac10/ticket/3033#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3033#comment:3</guid> <description> <p> Whoich compiler? Can you provide a test case please? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Sat, 16 May 2009 15:50:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3033#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3033#comment:4</guid> <description> <p> The OP says (first sentence) <code>I've recently added Boost to an Xcode 3.1.2 project with the following warnings enabled in GCC/G++ 4.0.1:</code> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Sat, 16 May 2009 18:57:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3033#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3033#comment:5</guid> <description> <p> Ah darn. I should've read. I only read the email notifications when the ticket was reassigned to me. I'll fix this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sat, 12 Jun 2010 17:59:16 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3033#comment:6 https://svn.boost.org/trac10/ticket/3033#comment:6 <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/62869" title="Clean up GCC warnings. Fixes #3033.">[62869]</a>) Clean up GCC warnings. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/3033" title="#3033: Bugs: Boost::Fusion: Shadow Variables and Unused Globals Cause ... (closed: fixed)">#3033</a>. </p> Ticket