Boost logo

Boost :

From: Stephan T. Lavavej (stl_at_[hidden])
Date: 2006-03-20 05:02:41


Hi,

Boost 1.33.1 contains a number of constructs which cause warnings when
compiled with GCC 3.4.2 (and other versions) using some warning flags. The
majority of warnings are -Wshadow warnings and are easily correctable. One
is a C cast that should be written as a const_cast. The most severe one is
an omission of "const" that produces a warning under -Wcast-qual.

I maintain a local patch that fixes these things (as otherwise I can't use
these warning flags on my own code), but it'd be really nice if they were
fixed in Boost mainline. The C cast and -Wcast-qual problems have obvious
fixes. My fixes for the -Wshadow warnings involve prepending x_ to variable
names, since I don't need to be inventive. Better names should probably be
chosen.

I reported these problems against 1.33.0, but they appeared unchanged in
1.33.1.

My patch is here: http://stl.nuwen.net/boost-1.33.1.patch

* The following files have shadow warnings:
boost/date_time/gregorian/gregorian_io.hpp
boost/date_time/period_formatter.hpp
boost/date_time/time_duration.hpp
boost/date_time/time_system_counted.hpp
boost/format/format_implementation.hpp
boost/regex/v4/basic_regex_creator.hpp
boost/regex/v4/match_results.hpp

* This file has shadow warnings, and a redundant typedef that causes a
shadow warning:
boost/regex/v4/basic_regex_parser.hpp

* This file has a C cast that should be a const_cast:
boost/range/detail/implementation_help.hpp

* This file omits a "const", which causes a nasty -Wcast-qual warning:
boost/token_iterator.hpp

The omission of the const is not intentional, if you look at the template
carefully.
The warning that this generates is here:
http://stl.nuwen.net/boost-warning.txt

* This file says "bash" when it should say "sh". MSYS bash appears under
"sh" but not "bash". This is really minor, since in 1.33.1 I don't even need
to execute gcc_gen.sh, but it'd be nice to have it fixed.
libs/regex/build/gcc_gen.sh

Finally, Boost Regex's gcc.mak causes problems for MinGW MSYS. It really
doesn't like trailing slashes. The patch for this is here:
http://stl.nuwen.net/boost-1.33.1-gcc.mak.patch

I believe that other systems don't require trailing slashes, but I'm not
sure. (I am only concerned with the -I../../../ here; the optimization
settings are purely for myself and should not be put into mainline.)

Thanks!
Stephan T. Lavavej


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk