diff --git a/CMakeLists.txt b/CMakeLists.txt index ca173404d..7ef09b6f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -268,6 +268,7 @@ else() "-Wfloat-equal" "-Winit-self" "-Wno-error=deprecated-declarations" + "-Wnon-virtual-dtor" "-Wpointer-arith" "-Wuninitialized" "-Wunused" @@ -284,7 +285,7 @@ else() list(APPEND STRICT_OPTIONS_C "-fno-inline-small-functions") endif() if(CMAKE_C_COMPILER_ID MATCHES "Clang") - list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-array-bounds -Wdelete-non-virtual-dtor") + list(APPEND STRICT_OPTIONS_CPP "-Qunused-arguments" "-Wno-array-bounds") endif() if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") list(APPEND STRICT_OPTIONS_CXX "-x c++") diff --git a/src/address/address.cpp b/src/address/address.cpp index 4d263aa73..bd875f7a2 100644 --- a/src/address/address.cpp +++ b/src/address/address.cpp @@ -17,12 +17,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "linphone/utils/utils.h" - #include "address-p.h" #include "address/identity-address.h" #include "c-wrapper/c-wrapper.h" -#include "c-wrapper/internal/c-sal.h" #include "containers/lru-cache.h" #include "logger/logger.h" diff --git a/src/object/property-container.cpp b/src/object/property-container.cpp index 24e46174e..dbd216ace 100644 --- a/src/object/property-container.cpp +++ b/src/object/property-container.cpp @@ -36,14 +36,14 @@ public: // ----------------------------------------------------------------------------- -PropertyContainer::PropertyContainer () : mPrivate(new PropertyContainerPrivate) {} +PropertyContainer::PropertyContainer () : mPrivate(nullptr) {} /* * Empty copy constructor. Don't change this pattern. * PropertyContainer is an Entity component, not a simple structure. * An Entity is UNIQUE. */ -PropertyContainer::PropertyContainer (const PropertyContainer &) : mPrivate(new PropertyContainerPrivate) {} +PropertyContainer::PropertyContainer (const PropertyContainer &) : mPrivate(nullptr) {} PropertyContainer::~PropertyContainer () { delete mPrivate; @@ -54,19 +54,23 @@ PropertyContainer &PropertyContainer::operator= (const PropertyContainer &) { } Variant PropertyContainer::getProperty (const string &name) const { - L_D(); - auto it = d->properties.find(name); - return it == d->properties.cend() ? Variant() : it->second; + if (!mPrivate) + return Variant(); + auto &properties = mPrivate->properties; + auto it = properties.find(name); + return it == properties.cend() ? Variant() : it->second; } void PropertyContainer::setProperty (const string &name, const Variant &value) { - L_D(); - d->properties[name] = value; + if (!mPrivate) + mPrivate = new PropertyContainerPrivate(); + mPrivate->properties[name] = value; } void PropertyContainer::setProperty (const string &name, Variant &&value) { - L_D(); - d->properties[name] = move(value); + if (!mPrivate) + mPrivate = new PropertyContainerPrivate(); + mPrivate->properties[name] = move(value); } LINPHONE_END_NAMESPACE diff --git a/src/object/property-container.h b/src/object/property-container.h index 53a885ddd..8f9db93bb 100644 --- a/src/object/property-container.h +++ b/src/object/property-container.h @@ -41,9 +41,7 @@ public: void setProperty (const std::string &name, Variant &&value); private: - PropertyContainerPrivate *mPrivate = nullptr; - - L_DECLARE_PRIVATE(PropertyContainer); + PropertyContainerPrivate *mPrivate; }; LINPHONE_END_NAMESPACE