Opened 11 years ago
Closed 9 years ago
#6136 closed Patches (fixed)
Fix for "variable set but not used" warning with GCC >= 4.6
Reported by: | Owned by: | az_sw_dude | |
---|---|---|---|
Milestone: | To Be Determined | Component: | date_time |
Version: | Boost 1.54.0 | Severity: | Problem |
Keywords: | Cc: |
Description
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.
Attachments (1)
Change History (8)
by , 11 years ago
Attachment: | gcc-warnings.patch added |
---|
comment:2 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
follow-up: 4 comment:3 by , 9 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I would like to bring attention to this bug. I'm surprised that although it was fixed nine months ago, the change did not make it to 1.54 beta1 or to trunk. Is that an oversight?
Example of what I expected was the removal of the unused variable current_char:
https://svn.boost.org/trac/boost/changeset/80797#file5
but what is found in 1.54 beta1 looks like this
http://svn.boost.org/svn/boost/trunk/boost/date_time/format_date_parser.hpp
comment:4 by , 9 years ago
Version: | Boost 1.48.0 → Boost 1.54.0 |
---|
To clarify (also selecting 1.54.0 as Version) that the issue is still found in
- 1.54 beta1
- trunk
- release branch
http://svn.boost.org/svn/boost/branches/release/boost/date_time/format_date_parser.hpp http://svn.boost.org/svn/boost/trunk/boost/date_time/format_date_parser.hpp
comment:5 by , 9 years ago
comment:7 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
patch that fixes the warnings