CXX-3043 Address Coverity warnings for Ro3/Ro5 violations #1142
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves CXX-3043. Verified by this patch.
This PR explicitly defaults or deletes special member functions (SMFs) which are currently implicitly defaulted or deleted, in accordance with the Rule of All or Nothing. This addresses multiple Coverity issues as well as a few
-Wdeprecated-copy-with-*
Clang warnings (depending on implicit default of copy SMFs given a user-declared dtor, copy ctor, or copy assign op).This PR should NOT change either the API or the ABI. This PR should NOT change the behavior at either compile-time or runtime, with exactly one exception:
index_model
's explicitly deleted copy assignment operator is now defaulted. It is unclear why this function was deleted when all other SMFs are (out-of-line) defaulted. This change is not expected to break user code.Some additional notes worth mentioning:
= default
within class definition does not require(BSONCXX|MONGOCXX)_INLINE
perVISIBILITY_INLINES_HIDDEN=ON
, as class member functions defined within the class definition are implicitlyinline
(even with= default
), so all instances of such redundant inline macro usage are removed for consistency.concatenate.hpp
is no longer an issue (AFAICT).noexcept
for defaulted/deleted SMFs. This is only applicable to SFMs that are defaulted on first declaration, thus SMFs defaulted out-of-line still require explicitnoexcept
.