Skip to content

Commit 7798c94

Browse files
Chippiewilldaverigby
authored andcommitted
Modify DISALLOW_COPY_AND_ASSIGN to delete instead of relying on visibility
By deleting the functions instead of just declaring them it becomes harder to use the macros wrong. It also means more meaningful compiler errors are generated if someone tries to use the deleted functions. This also removes an unused private variable that can now be statically proven by the compiler as unused (and therefore generates a warning). Change-Id: I13c7a04a8e56bc62a5a6b9f765889e88428a7388 Reviewed-on: http://review.couchbase.org/70587 Tested-by: buildbot <build@couchbase.com> Reviewed-by: Daniel Owen <owend@couchbase.com> Reviewed-by: Dave Rigby <daver@couchbase.com>
1 parent 82d4cb2 commit 7798c94

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/flusher.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ class Flusher {
125125
double minSleepTime;
126126
uint16_t initCommitInterval;
127127
uint16_t currCommitInterval;
128-
rel_time_t flushStart;
129128
std::atomic<bool> forceShutdownReceived;
130129
std::queue<uint16_t> hpVbs;
131130
std::queue<uint16_t> lpVbs;

src/utility.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,13 @@
3131

3232
#include <memcached/extension.h>
3333

34-
// Stolen from http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
3534
// A macro to disallow the copy constructor and operator= functions
36-
// This should be used in the private: declarations for a class
3735
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
38-
TypeName(const TypeName&); \
39-
void operator=(const TypeName&)
36+
TypeName(const TypeName&) = delete; \
37+
void operator=(const TypeName&) = delete
4038

4139
#define DISALLOW_ASSIGN(TypeName) \
42-
void operator=(const TypeName&)
40+
void operator=(const TypeName&) = delete
4341

4442

4543
// Utility functions implemented in various modules.

0 commit comments

Comments
 (0)