[CXX-243] Fails to build with gcc-4.8.2 when optimization is enabled Created: 28/May/14  Updated: 13/Jun/14  Resolved: 29/May/14

Status: Closed
Project: C++ Driver
Component/s: Implementation
Affects Version/s: legacy-0.9.0
Fix Version/s: legacy-0.10.0

Type: Bug Priority: Critical - P2
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-241 Add optimized travis builds Closed

 Description   

When building with optimization the command_writer.cpp file fails to build due to a warning being escalated to an error:

src/mongo/client/command_writer.cpp: In member function 'virtual void mongo::CommandWriter::write(const mongo::StringData&, const std::vector<mongo::WriteOperation*>&, bool, const mongo::WriteConcern*, std::vector<mongo::BSONObj>*)':
src/mongo/client/command_writer.cpp:55:57: error: 'requestType' may be used uninitialized in this function [-Werror=maybe-uninitialized]
             if (requestType == (*iter)->operationType() &&
                                                         ^
cc1plus: all warnings being treated as errors
scons: *** [build/cached/mongo/client/command_writer.o] Error 1



 Comments   
Comment by Githook User [ 29/May/14 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: CXX-243 Refactor batching loop in writers

The existing loop, while correct, introduced a lot of state variables and iterator
manipulation. Some compilers were unable to prove initialization of all state
variables on all paths.

Refactoring to use a double loop and two tracking iterators removes the need
for the extra state and iterator manipulation and elminiates the warnings.
Branch: legacy
https://github.com/mongodb/mongo-cxx-driver/commit/f6184b78fee3d607929f8820769cb159f185ccdb

Comment by Andrew Morrow (Inactive) [ 29/May/14 ]

https://github.com/mongodb/mongo-cxx-driver/pull/86

Comment by Andrew Morrow (Inactive) [ 28/May/14 ]

Bumping to critical since building with optimization is the normal user mode of building, and because travis changes are blocking on this. Not 'blocker' only because can be worked around with --disable-warnings-as-errors

Generated at Wed Feb 07 21:58:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.