Subject: [Boost-bugs] [Boost C++ Libraries] #6136: Fix for "variable set but not used" warning with GCC >= 4.6
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-17 22:02:44
#6136: Fix for "variable set but not used" warning with GCC >= 4.6
------------------------------------+---------------------------------------
Reporter: zeratul976@⦠| Owner: az_sw_dude
Type: Patches | Status: new
Milestone: To Be Determined | Component: date_time
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
------------------------------------+---------------------------------------
GCC >= 4.6 gives the following "variable set but not used" warnings for
code in boost/date_time/format_date_parser.hpp:
{{{
../../lib/boost/boost/date_time/format_date_parser.hpp:479:11: warning:
variable 'current_char' set but not used [-Wunused-but-set-variable]
../../lib/boost/boost/date_time/format_date_parser.hpp:584:11: warning:
variable 'current_char' set but not used [-Wunused-but-set-variable]
../../lib/boost/boost/date_time/format_date_parser.hpp:677:11: warning:
variable 'current_char' set but not used [-Wunused-but-set-variable]
}}}
The warnings are triggered by any code that instantiates the
format_date_parser class, for example:
{{{
#include <sstream>
#include <boost/date_time/posix_time/posix_time.hpp>
int main()
{
std::stringstream ss;
boost::posix_time::ptime p;
ss >> p;
}
}}}
Looking at the code, I can see that the 'current_char' variable is indeed
set but never used in those functions.
The attached patch fixes the warnings by removing the 'current_char'
variable from those functions.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6136> 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:07 UTC