Boost C++ Libraries: Ticket #3924: [PATCH] gcc warning cleanup https://svn.boost.org/trac10/ticket/3924 <p> Compiling software using Boost with aggressive warning flags causes excessive amounts of gcc warning barf. For example: </p> <blockquote class="citation"> <p> make clean all 2&gt;&amp;1 | wc -l </p> </blockquote> <p> 1432 </p> <blockquote class="citation"> <p> make clean all 2&gt;&amp;1 | grep -iv boost | wc -l </p> </blockquote> <p> 254 </p> <p> This is a real-life example from a relatively small project using gil and property_tree. Needless to say, finding my own errors is kind of tedious. </p> <p> Attached is a patch that fixes all the warnings I encountered: </p> <ul><li>BOOST_MSVC_WORKAROUND_GUARD is defined in boost/detail/workaround.hpp, but BOOST_MSVC_FULL_VER_WORKAROUND_GUARD is not. This causes a lot of warnings. </li><li>boost/exception/exception.hpp has a rethrow function, that GCC reports as a possible candidate for noreturn. I added a BOOST_WORKAROUND to check for gcc version &gt;= 3. On match, <span class="underline">attribute</span>((noreturn)) was added. Note that in reality noreturn was introduced in GCC 2.5, but I don't know how you should check against that in Boost. </li><li>gil has excessive amounts of function parameters, that have the same name as a method within the class. All of these parameter names have been prefixed with "p_". </li><li>property_tree has excessive amounts of function parameters, that have the same name as a method within the class. All of these parameter names have been prefixed with "p_". </li><li>property_tree has some instances of variables within functions, that have the same name as a method within the class. All of these variable names have been prefixed with something deemed appropriate. </li><li>multi_index had issues similar to those of property_tree and gil. </li></ul><p> I've listed the patch as cosmetic, because it does not modify any behavior in any way. The patch is against the SVN revision 59655 of yesterday night, and should work just fine. If you're not satisfied with the name changes, you can easily just replace the p_ with whatever. </p> <p> To reproduce the warnings without the patch, compile with the following GCC flags: -Wall -Wcast-align -Wconversion -Wdisabled-optimization -Werror=return-type -Wextra -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wno-multichar -Wpacked -Wredundant-decls -Wshadow -Wswitch-default -Wundef -Wwrite-strings -Wctor-dtor-privacy -Werror=non-virtual-dtor -Woverloaded-virtual </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3924 Trac 1.4.3 Tatu Kilappa <tatu.kilappa@…> Fri, 12 Feb 2010 08:08:44 GMT attachment set https://svn.boost.org/trac10/ticket/3924 https://svn.boost.org/trac10/ticket/3924 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost_r59655_gcc_warning_cleanup.patch</span> </li> </ul> <p> Removes excessive gcc warning barf when using gil or property_tree </p> Ticket Steven Watanabe Fri, 12 Mar 2010 16:35:37 GMT <link>https://svn.boost.org/trac10/ticket/3924#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3924#comment:1</guid> <description> <p> This is much more likely to be noticed if you split it up into patches against individual libraries. As things stand, no one is responsible for dealing with it. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>tkilappa</dc:creator> <pubDate>Mon, 15 Mar 2010 20:26:08 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3924#comment:2 https://svn.boost.org/trac10/ticket/3924#comment:2 <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">wontfix</span> </li> </ul> <p> Invalidating this patch, will post a new patch for each library individually containing same fix content. </p> Ticket Steven Watanabe Mon, 15 Mar 2010 21:23:38 GMT <link>https://svn.boost.org/trac10/ticket/3924#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3924#comment:3</guid> <description> <p> See <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4012" title="#4012: Patches: [PATCH] boost/detail warning cleanup (closed: fixed)">#4012</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4013" title="#4013: Patches: [PATCH] boost/exception gcc warning cleanup (closed: fixed)">#4013</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4014" title="#4014: Patches: [PATCH] boost/gil gcc warning cleanup (closed: fixed)">#4014</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4015" title="#4015: Patches: [PATCH] boost/program_options gcc warning cleanup (closed: fixed)">#4015</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4016" title="#4016: Patches: [PATCH] boost/property_tree gcc warning cleanup (closed: fixed)">#4016</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4017" title="#4017: Patches: [PATCH] boost/test gcc warning cleanup (closed: fixed)">#4017</a>, <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4018" title="#4018: Patches: [PATCH] boost/multi_index gcc warning cleanup (closed: fixed)">#4018</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 12 Oct 2010 18:04:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3924#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3924#comment:4</guid> <description> <p> The same warnings when using Boost::Variant. </p> </description> <category>Ticket</category> </item> </channel> </rss>