Opened 13 years ago

Closed 13 years ago

Last modified 12 years ago

#3924 closed Patches (wontfix)

[PATCH] gcc warning cleanup

Reported by: Tatu Kilappa <tatu.kilappa@…> Owned by:
Milestone: To Be Determined Component: None
Version: Boost Development Trunk Severity: Cosmetic
Keywords: gcc warning Cc:

Description

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

Attachments (1)

boost_r59655_gcc_warning_cleanup.patch (53.3 KB ) - added by Tatu Kilappa <tatu.kilappa@…> 13 years ago.
Removes excessive gcc warning barf when using gil or property_tree

Download all attachments as: .zip

Change History (5)

by Tatu Kilappa <tatu.kilappa@…>, 13 years ago

Removes excessive gcc warning barf when using gil or property_tree

comment:1 by Steven Watanabe, 13 years ago

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.

comment:2 by tkilappa, 13 years ago

Resolution: wontfix
Status: newclosed

Invalidating this patch, will post a new patch for each library individually containing same fix content.

comment:3 by Steven Watanabe, 13 years ago

comment:4 by anonymous, 12 years ago

The same warnings when using Boost::Variant.

Note: See TracTickets for help on using tickets.