Opened 13 years ago

Closed 12 years ago

#3477 closed Patches (worksforme)

warning: missing initializer for member ‘tm::tm_sec’ ..

Reported by: me@… Owned by: az_sw_dude
Milestone: Component: date_time
Version: Boost 1.40.0 Severity: Cosmetic
Keywords: Cc:

Description

We recently upgraded to boost 1.40 and now we got some new warnings from GCC:

warning: missing initializer for member ‘tm::tm_sec’
...

I've attached a patch that fixes these (at least for the code we use, there might be other occurences).

Regards

Mirko

Attachments (1)

date_time.patch (1.2 KB ) - added by me@… 13 years ago.

Download all attachments as: .zip

Change History (3)

by me@…, 13 years ago

Attachment: date_time.patch added

comment:1 by Marshall Clow, 13 years ago

My testing shows that gcc 4.2.1 does not generate this error.

#include <boost/date_time/gregorian/conversion.hpp>

int main ( int argc, char *argv[] ) {}

$ g++ -I /Marshall/Sources/boost/boost_1_42_0 -wAll junk.cpp
$ 
$ g++ --version
i686-apple-darwin10-g++-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1)

Comment (via email) from AndySem:

I'm not sure the patch is valid. std::tm can have different number of members on different compilers and thus the patch may bring either warnings or errors on other platforms. And the warning is nonsense in the first place, because zero initialization is intended to be done by the compiler (which it actually does).

I think, at least conditional compilation should be used in this case.

comment:2 by Andrey Semashev, 12 years ago

Resolution: worksforme
Status: newclosed
Note: See TracTickets for help on using tickets.