[Boost-bugs] [Boost C++ Libraries] #3924: [PATCH] gcc warning cleanup

Subject: [Boost-bugs] [Boost C++ Libraries] #3924: [PATCH] gcc warning cleanup
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2010-02-12 08:07:45


#3924: [PATCH] gcc warning cleanup
---------------------------------------------------+------------------------
 Reporter: Tatu Kilappa <tatu.kilappa@…> | Owner:
     Type: Patches | Status: new
Milestone: To Be Determined | Component: None
  Version: Boost Development Trunk | Severity: Cosmetic
 Keywords: gcc warning |
---------------------------------------------------+------------------------
 Compiling software using Boost with aggressive warning flags causes
 excessive amounts of gcc warning barf. For example:

> make clean all 2>&1 | wc -l
 1432
> make clean all 2>&1 | grep -iv boost | wc -l
 254

 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.

 Attached is a patch that fixes all the warnings I encountered:
 - 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.
 - 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 >= 3. On match, __attribute__((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.
 - 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_".
 - 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_".
 - 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.
 - multi_index had issues similar to those of property_tree and gil.

 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.

 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

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3924>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:02 UTC