[CXX-377] clang 3.5 warning, dbclientcursor.h Created: 20/Oct/14  Updated: 03/Apr/23  Resolved: 09/Dec/14

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: legacy-0.0-26compat-2.6.5
Fix Version/s: legacy-0.0-26compat-2.6.6

Type: Bug Priority: Major - P3
Reporter: Allan Bazinet Assignee: Unassigned
Resolution: Done Votes: 0
Labels: legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates CXX-339 Backport server r2.7.6..r2.7.7 changes Closed

 Description   

Using the clang 3.5 compiler, the following warning is issued during compilation of the 26compat branch.

While this may not be of immediate concern, it seems odd enough to report.

clang++ -O3 -g -std=c+11 -stdlib=libc+ -I ../libs/ami/include -emit-llvm -c
In file included from ../libs/ami/include/mongo/client/dbclient.h:40:
In file included from ../libs/ami/include/mongo/client/connpool.h:22:
In file included from ../libs/ami/include/mongo/client/dbclientinterface.h:1374:
../libs/ami/include/mongo/client/dbclientcursor.h:120:40: warning: 'this' pointer cannot be null in well-defined C++ code; pointer may be
assumed to always convert to true [-Wundefined-bool-conversion]
bool isDead() const

{ return !this || cursorId == 0; }

^~~
1 warning generated.



 Comments   
Comment by Andrew Morrow (Inactive) [ 09/Dec/14 ]

https://github.com/mongodb/mongo-cxx-driver/commit/a3fb94cb14f95a92b9c33fa04e2bfb51d3b8c1d1

Comment by Githook User [ 09/Dec/14 ]

Author:

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

Message: CXX-377 Fix clang warnings in headers

Cherry pick of server commit db59c175c736609970b52f91e30fc2277e22b25b
Branch: 26compat
https://github.com/mongodb/mongo-cxx-driver/commit/a3fb94cb14f95a92b9c33fa04e2bfb51d3b8c1d1

Comment by Andrew Morrow (Inactive) [ 21/Oct/14 ]

I think I agree that it would be good for the 26compat headers to be able to be consumed without warnings by clang-3.5.

I'm putting this into the 'planning' bucket so we don't lose track of it.

Comment by Allan Bazinet [ 20/Oct/14 ]

Andrew,

Thanks for the update; we'll apply the fixes in SERVER-15182 to our version, as they seem quite straightforward.

Given that the documentation for the legacy branch still discourages production use, I would encourage backport of this fix to the 26compat branch.

Comment by Andrew Morrow (Inactive) [ 20/Oct/14 ]

Hi -

Thanks for the report. This has actually already been fixed in the server master branch, and that fix has been backported to the C++ driver legacy branch. The fix will be available in the upcoming legacy-1.0.0-rc1 release expected later this week. See SERVER-15182 and CXX-339 for information about when and where this fix was applied.

Please note though that we are unlikely to fix this in the 26compat branch unless the fix for SERVER-15182 is applied in the 2.6 server branch, and that ticket is not currently marked for backport.

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