Skip to content

Commit

Permalink
CCUtil: Define virtual destructor in .cpp file
Browse files Browse the repository at this point in the history
This fixes compiler warnings from clang:

src/ccutil/ccutil.h:51:7: warning:
 'CCUtil' has no out-of-line virtual method definitions;
 its vtable will be emitted in every translation unit [-Wweak-vtables]

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Sep 4, 2018
1 parent 14c23c9 commit 5b8162f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/ccutil/ccutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ CCUtil::CCUtil() :
" whether to adapt to a character", &params_) {
}

// Destructor.
// It is defined here, so the compiler can create a single vtable
// instead of weak vtables in every compilation unit.
CCUtil::~CCUtil() = default;

CCUtilMutex::CCUtilMutex() {
#ifdef _WIN32
mutex_ = CreateMutex(0, FALSE, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/ccutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class CCUtilMutex {
class CCUtil {
public:
CCUtil();
virtual ~CCUtil() = default;
virtual ~CCUtil();

public:
// Read the arguments and set up the data path.
Expand Down

0 comments on commit 5b8162f

Please sign in to comment.