[CXX-1056] Add mechanism to disable deprecation warnings for a given section of code Created: 01/Oct/16  Updated: 05/Oct/17  Resolved: 25/May/17

Status: Closed
Project: C++ Driver
Component/s: Build
Affects Version/s: None
Fix Version/s: 3.2.0-rc0

Type: Task Priority: Major - P3
Reporter: J Rassi Assignee: J Rassi
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by CXX-1226 Resolve json.cpp compile warnings int... Closed
is depended on by CXX-1232 Backport 'CXX-1226 Resolve json.cpp c... Closed
is depended on by CXX-979 Add BSONCXX_DEPRECATED to deprecated ... Closed
Problem/Incident
causes CXX-1447 Reduce use of deprecated methods in t... Closed
Related
related to CXX-1348 Remove -Werror from CMAKE_CXX_FLAGS a... Closed

 Description   

It would be nice to be able to test deprecated driver functionality without generating deprecation warnings in the test compile output.

In clang, deprecation warnings can be disabled for a section of code as follows:

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
...
#pragma clang diagnostic pop

We should hide such compiler-specific functionality behind a header or macro, and have test code use this mechanism to disable deprecation warnings for the tests of deprecated functionality.

As part of the work for this ticket, all existing deprecated API methods should have the BSONCXX_DEPRECATED or MONGOCXX_DEPRECATED specifier added to the method declaration. No deprecation specifiers will be added to public types.

In addition, as part of the work for this ticket, we should remove "-Wno-error=deprecated-declarations" from our Evergreen compiler flags, which was temporarily added to work around CXX-1226.



 Comments   
Comment by J Rassi [ 25/May/17 ]

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

Comment by J Rassi [ 25/May/17 ]

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

Comment by Githook User [ 21/Apr/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: Revert "CXX-1056 Temporarily add -Wno-error=deprecated-declarations to compile"

This reverts commit 438916803e0739f6c5972111ba4d14b0f060a358.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/6adf6714e63247a0d13782a06b806c3bee0eeb46

Comment by Githook User [ 23/Feb/17 ]

Author:

{u'username': u'jrassi', u'name': u'J. Rassi', u'email': u'rassi@10gen.com'}

Message: CXX-1056 Temporarily add -Wno-error=deprecated-declarations to compile

This is necessary to work around the fact that the driver currently
calls into deprecated libbson functionality (see CXX-1226 for
details). "-Wno-error=deprecated-declarations" will be removed as
part of the resolution of CXX-1056.
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/438916803e0739f6c5972111ba4d14b0f060a358

Comment by J Rassi [ 01/Oct/16 ]

See https://github.com/mongodb/mongo-cxx-driver/pull/541#discussion_r80521303 for further discussion.

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