From b52e171b6737522fe5e7739646f523becd315381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Thu, 18 May 2017 14:30:20 +0200 Subject: [core] add error for non-virtual destructor deletes + add virtual dtors --- CMakeLists.txt | 2 +- include/mbgl/map/map_observer.hpp | 2 ++ src/mbgl/programs/symbol_program.hpp | 8 +++++--- src/mbgl/sprite/sprite_atlas.hpp | 1 + src/mbgl/text/glyph_atlas.hpp | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f8757d0c88..f0c7a2ac57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ endif(WITH_COVERAGE) set(CMAKE_CONFIGURATION_TYPES Debug Release) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -ftemplate-depth=1024 -Wall -Wextra -Wshadow -Werror -Wno-variadic-macros -Wno-unknown-pragmas") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -ftemplate-depth=1024 -Wall -Wextra -Wshadow -Wnon-virtual-dtor -Werror -Wno-variadic-macros -Wno-unknown-pragmas") if(APPLE) # -Wno-error=unused-command-line-argument is required due to https://llvm.org/bugs/show_bug.cgi?id=7798 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-command-line-argument") diff --git a/include/mbgl/map/map_observer.hpp b/include/mbgl/map/map_observer.hpp index 4fefb79121..f63e5f2af3 100644 --- a/include/mbgl/map/map_observer.hpp +++ b/include/mbgl/map/map_observer.hpp @@ -10,6 +10,8 @@ namespace mbgl { class MapObserver { public: + virtual ~MapObserver() = default; + static MapObserver& nullObserver() { static MapObserver mapObserver; return mapObserver; diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 1cac99bfc2..46f532e5c4 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -93,6 +93,8 @@ public: // particular attribute & uniform logic needed by each possible type of the {Text,Icon}Size properties. class SymbolSizeBinder { public: + virtual ~SymbolSizeBinder() = default; + using Uniforms = gl::Uniforms< uniforms::u_is_size_zoom_constant, uniforms::u_is_size_feature_constant, @@ -129,7 +131,7 @@ Range getCoveringStops(Stops s, float lowerZoom, float upperZoom) { }; } -class ConstantSymbolSizeBinder : public SymbolSizeBinder { +class ConstantSymbolSizeBinder final : public SymbolSizeBinder { public: using PropertyValue = variant>; @@ -198,7 +200,7 @@ public: optional> function; }; -class SourceFunctionSymbolSizeBinder : public SymbolSizeBinder { +class SourceFunctionSymbolSizeBinder final : public SymbolSizeBinder { public: using Vertex = gl::detail::Vertex>; using VertexVector = gl::VertexVector; @@ -251,7 +253,7 @@ public: optional buffer; }; -class CompositeFunctionSymbolSizeBinder: public SymbolSizeBinder { +class CompositeFunctionSymbolSizeBinder final : public SymbolSizeBinder { public: using Vertex = SymbolSizeAttributes::Vertex; using VertexVector = gl::VertexVector; diff --git a/src/mbgl/sprite/sprite_atlas.hpp b/src/mbgl/sprite/sprite_atlas.hpp index 5afddaebce..c3efeff44b 100644 --- a/src/mbgl/sprite/sprite_atlas.hpp +++ b/src/mbgl/sprite/sprite_atlas.hpp @@ -43,6 +43,7 @@ typedef std::set IconDependencies; class IconRequestor { public: + virtual ~IconRequestor() = default; virtual void onIconsAvailable(IconMap) = 0; }; diff --git a/src/mbgl/text/glyph_atlas.hpp b/src/mbgl/text/glyph_atlas.hpp index f4c4601530..ad9cf35adc 100644 --- a/src/mbgl/text/glyph_atlas.hpp +++ b/src/mbgl/text/glyph_atlas.hpp @@ -30,6 +30,7 @@ class Context; class GlyphRequestor { public: + virtual ~GlyphRequestor() = default; virtual void onGlyphsAvailable(GlyphPositionMap) = 0; }; -- cgit v1.2.1