Skip to content

Commit 04e31f8

Browse files
authored
CXX-3043 Address Coverity warnings for Ro3/Ro5 violations (#1142)
1 parent e51f29d commit 04e31f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+219
-33
lines changed

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ class value {
7676
value(const value&);
7777
value& operator=(const value&);
7878

79-
value(value&&) noexcept = default;
80-
value& operator=(value&&) noexcept = default;
79+
value(value&&) = default;
80+
value& operator=(value&&) = default;
8181

8282
///
8383
/// Get a view over the document owned by this value.

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/array.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class array : public sub_array {
5454
return *this;
5555
}
5656

57+
array(const array&) = delete;
58+
array& operator=(const array&) = delete;
59+
5760
///
5861
/// @return A view of the BSON array.
5962
///

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/document.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ class document : public sub_document {
4242
///
4343
BSONCXX_INLINE document() : sub_document(&_core), _core(false) {}
4444

45+
~document() = default;
46+
4547
///
4648
/// Move constructor
4749
///
@@ -56,6 +58,9 @@ class document : public sub_document {
5658
return *this;
5759
}
5860

61+
document(const document&) = delete;
62+
document& operator=(const document&) = delete;
63+
5964
///
6065
/// @return A view of the BSON document.
6166
///

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/concatenate.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ namespace builder {
3232
struct concatenate_doc {
3333
document::view_or_value doc;
3434

35-
// MSVC seems to need a hint that it should always
36-
// inline this destructor.
37-
BSONCXX_INLINE ~concatenate_doc() = default;
38-
3935
///
4036
/// Conversion operator that provides a view of the wrapped concatenate
4137
/// document.
@@ -64,10 +60,6 @@ struct concatenate_doc {
6460
struct concatenate_array {
6561
array::view_or_value array;
6662

67-
// MSVC seems to need a hint that it should always
68-
// inline this destructor.
69-
BSONCXX_INLINE ~concatenate_array() = default;
70-
7163
///
7264
/// Conversion operator that provides a view of the wrapped concatenate
7365
/// array.

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ class core {
5959

6060
~core();
6161

62+
core(const core&) = delete;
63+
core& operator=(const core&) = delete;
64+
6265
///
6366
/// Appends a key passed as a non-owning stdx::string_view.
6467
///

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ class value {
7575
///
7676
explicit value(document::view view);
7777

78+
~value() = default;
79+
7880
value(const value&);
7981
value& operator=(const value&);
8082

81-
value(value&&) noexcept = default;
82-
value& operator=(value&&) noexcept = default;
83+
value(value&&) = default;
84+
value& operator=(value&&) = default;
8385

8486
///
8587
/// Constructor used for serialization of user objects. This uses argument-dependent lookup

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class view_or_value : public bsoncxx::v_noabi::view_or_value<stdx::string_view,
4545
///
4646
/// Default constructor, equivalent to using an empty string.
4747
///
48-
BSONCXX_INLINE view_or_value() = default;
48+
view_or_value() = default;
4949

5050
///
5151
/// Construct a string::view_or_value using a null-terminated const char *.

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/view_or_value.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,16 @@ class view_or_value {
4646
static_assert(std::is_default_constructible<View>::value,
4747
"View type must be default constructible");
4848

49+
///
50+
/// Destroys a view_or_value.
51+
///
52+
~view_or_value() = default;
53+
4954
///
5055
/// Default-constructs a view_or_value. This is equivalent to constructing a
5156
/// view_or_value with a default-constructed View.
5257
///
53-
BSONCXX_INLINE view_or_value() = default;
58+
view_or_value() = default;
5459

5560
///
5661
/// Construct a view_or_value from a View. When constructed with a View,

src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ class BSONCXX_TEST_API itoa {
2727
public:
2828
explicit itoa(uint32_t i = 0);
2929

30+
~itoa() = default;
31+
32+
itoa(itoa&& rhs) = delete;
33+
itoa& operator=(itoa&&) = delete;
34+
3035
itoa(const itoa& rhs) = delete;
3136
itoa& operator=(const itoa&) = delete;
3237

src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/stack.hh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class stack {
5555
}
5656
}
5757

58+
stack(stack&&) = delete;
59+
stack& operator=(stack&&) = delete;
60+
61+
stack(const stack&) = delete;
62+
stack& operator=(const stack&) = delete;
63+
5864
bool empty() const {
5965
return _is_empty;
6066
}

src/mongocxx/include/mongocxx/v_noabi/mongocxx/client.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ class client {
9696
///
9797
~client();
9898

99+
client(const client&) = delete;
100+
client& operator=(const client&) = delete;
101+
99102
///
100103
/// Returns true if the client is valid, meaning it was not default constructed
101104
/// or moved from.

src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,17 @@ class client_encryption {
5353
///
5454
/// Destroys a client_encryption.
5555
///
56-
~client_encryption() noexcept;
56+
~client_encryption();
5757

5858
///
5959
/// Move-constructs a client_encryption object.
6060
///
61-
client_encryption(client_encryption&&);
61+
client_encryption(client_encryption&&) noexcept;
6262

6363
///
6464
/// Move-assigns a client_encryption object.
6565
///
66-
client_encryption& operator=(client_encryption&&);
66+
client_encryption& operator=(client_encryption&&) noexcept;
6767

6868
client_encryption(const client_encryption&) = delete;
6969
client_encryption& operator=(const client_encryption&) = delete;

src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class cursor {
6060
///
6161
~cursor();
6262

63+
cursor(const cursor&) = delete;
64+
cursor& operator=(const cursor&) = delete;
65+
6366
///
6467
/// A cursor::iterator that points to the beginning of any available
6568
/// results. If begin() is called more than once, the cursor::iterator

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class command_failed_event {
4343
///
4444
~command_failed_event();
4545

46+
command_failed_event(command_failed_event&&) = default;
47+
command_failed_event& operator=(command_failed_event&&) = default;
48+
49+
command_failed_event(const command_failed_event&) = default;
50+
command_failed_event& operator=(const command_failed_event&) = default;
51+
4652
///
4753
/// Returns the server’s reply to the failed operation.
4854
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class command_started_event {
4343
///
4444
~command_started_event();
4545

46+
command_started_event(command_started_event&&) = default;
47+
command_started_event& operator=(command_started_event&&) = default;
48+
49+
command_started_event(const command_started_event&) = default;
50+
command_started_event& operator=(const command_started_event&) = default;
51+
4652
///
4753
/// Returns the command that has been started.
4854
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class command_succeeded_event {
4343
///
4444
~command_succeeded_event();
4545

46+
command_succeeded_event(command_succeeded_event&&) = default;
47+
command_succeeded_event& operator=(command_succeeded_event&&) = default;
48+
49+
command_succeeded_event(const command_succeeded_event&) = default;
50+
command_succeeded_event& operator=(const command_succeeded_event&) = default;
51+
4652
///
4753
/// Returns the server reply for the succeeded operation.
4854
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class heartbeat_failed_event {
4242
///
4343
~heartbeat_failed_event();
4444

45+
heartbeat_failed_event(heartbeat_failed_event&&) = default;
46+
heartbeat_failed_event& operator=(heartbeat_failed_event&&) = default;
47+
48+
heartbeat_failed_event(const heartbeat_failed_event&) = default;
49+
heartbeat_failed_event& operator=(const heartbeat_failed_event&) = default;
50+
4551
///
4652
/// Returns the failed operation's error message.
4753
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class heartbeat_started_event {
4242
///
4343
~heartbeat_started_event();
4444

45+
heartbeat_started_event(heartbeat_started_event&&) = default;
46+
heartbeat_started_event& operator=(heartbeat_started_event&&) noexcept = default;
47+
48+
heartbeat_started_event(const heartbeat_started_event&) = default;
49+
heartbeat_started_event& operator=(const heartbeat_started_event&) = default;
50+
4551
///
4652
/// Returns the host name.
4753
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class heartbeat_succeeded_event {
4141
///
4242
~heartbeat_succeeded_event();
4343

44+
heartbeat_succeeded_event(heartbeat_succeeded_event&&) = default;
45+
heartbeat_succeeded_event& operator=(heartbeat_succeeded_event&&) = default;
46+
47+
heartbeat_succeeded_event(const heartbeat_succeeded_event&) = default;
48+
heartbeat_succeeded_event& operator=(const heartbeat_succeeded_event&) = default;
49+
4450
///
4551
/// Returns the server reply for the succeeded operation.
4652
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class server_changed_event {
4242
///
4343
~server_changed_event();
4444

45+
server_changed_event(server_changed_event&&) = default;
46+
server_changed_event& operator=(server_changed_event&&) = default;
47+
48+
server_changed_event(const server_changed_event&) = default;
49+
server_changed_event& operator=(const server_changed_event&) = default;
50+
4551
///
4652
/// Returns the server host name.
4753
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class server_closed_event {
4343
///
4444
~server_closed_event();
4545

46+
server_closed_event(server_closed_event&&) = default;
47+
server_closed_event& operator=(server_closed_event&&) = default;
48+
49+
server_closed_event(const server_closed_event&) = default;
50+
server_closed_event& operator=(const server_closed_event&) = default;
51+
4652
///
4753
/// Returns the server host name.
4854
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ class server_description {
3737
///
3838
~server_description();
3939

40+
server_description(server_description&&) = default;
41+
server_description& operator=(server_description&&) = default;
42+
43+
server_description(const server_description&) = default;
44+
server_description& operator=(const server_description&) = default;
45+
4046
///
4147
/// An opaque id, unique to this server for this mongocxx::v_noabi::client or
4248
/// mongocxx::v_noabi::pool.

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ class server_opening_event {
4242
///
4343
~server_opening_event();
4444

45+
server_opening_event(server_opening_event&&) = default;
46+
server_opening_event& operator=(server_opening_event&&) = default;
47+
48+
server_opening_event(const server_opening_event&) = default;
49+
server_opening_event& operator=(const server_opening_event&) = default;
50+
4551
///
4652
/// Returns the server host name.
4753
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class topology_changed_event {
4141
///
4242
~topology_changed_event();
4343

44+
topology_changed_event(topology_changed_event&&) = default;
45+
topology_changed_event& operator=(topology_changed_event&&) = default;
46+
47+
topology_changed_event(const topology_changed_event&) = default;
48+
topology_changed_event& operator=(const topology_changed_event&) = default;
49+
4450
///
4551
/// An opaque id, unique to this topology for this mongocxx::v_noabi::client or
4652
/// mongocxx::v_noabi::pool.

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ class topology_closed_event {
4040
///
4141
~topology_closed_event();
4242

43+
topology_closed_event(topology_closed_event&&) = default;
44+
topology_closed_event& operator=(topology_closed_event&&) = default;
45+
46+
topology_closed_event(const topology_closed_event&) = default;
47+
topology_closed_event& operator=(const topology_closed_event&) = default;
48+
4349
///
4450
/// An opaque id, unique to this topology for this mongocxx::v_noabi::client or
4551
/// mongocxx::v_noabi::pool.

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ class topology_description {
119119
///
120120
~topology_description();
121121

122+
topology_description(topology_description&&) = default;
123+
topology_description& operator=(topology_description&&) = default;
124+
125+
topology_description(const topology_description&) = default;
126+
topology_description& operator=(const topology_description&) = default;
127+
122128
///
123129
/// The topology type: "Unknown", "Sharded", "ReplicaSetNoPrimary", "ReplicaSetWithPrimary", or
124130
/// "Single".

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ class topology_opening_event {
4040
///
4141
~topology_opening_event();
4242

43+
topology_opening_event(topology_opening_event&&) = default;
44+
topology_opening_event& operator=(topology_opening_event&&) = default;
45+
46+
topology_opening_event(const topology_opening_event&) = default;
47+
topology_opening_event& operator=(const topology_opening_event&) = default;
48+
4349
///
4450
/// An opaque id, unique to this topology for this mongocxx::v_noabi::client or
4551
/// mongocxx::v_noabi::pool.

src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ class index_model {
5353
///
5454
index_model(const index_model&);
5555

56-
index_model& operator=(const index_model&) = delete;
56+
///
57+
/// Copy assigns an index_model.
58+
///
59+
index_model& operator=(const index_model&) = default;
5760

5861
///
5962
/// Destroys an index_model.

src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class index_view {
4242

4343
~index_view();
4444

45+
index_view(const index_view&) = delete;
46+
index_view& operator=(const index_view&) = delete;
47+
4548
///
4649
/// @{
4750
///

src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ class instance {
107107
///
108108
~instance();
109109

110+
instance(const instance&) = delete;
111+
instance& operator=(const instance&) = delete;
112+
110113
///
111114
/// Returns the current unique instance of the driver. If an instance was explicitly created,
112115
/// that will be returned. If no instance has yet been created, a default instance will be

0 commit comments

Comments
 (0)