From 94c21264f8e2237de03a7d5916f859d0b9c16a5b Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Tue, 5 Nov 2019 13:54:30 +0200 Subject: [build] Enable more warnings on the next build Make compilation more pedantic. --- next/CMakeLists.txt | 18 +++++++++--------- platform/android/src/test/render_test_collator.cpp | 4 ++-- platform/darwin/src/MGLAccountManager.h | 2 +- platform/darwin/src/MGLConversion.h | 2 +- platform/darwin/src/MGLStyleValue_Private.h | 6 +++--- render-test/metadata.hpp | 6 +++--- render-test/runner.cpp | 3 ++- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/next/CMakeLists.txt b/next/CMakeLists.txt index 924761ad85..56bcf8a062 100644 --- a/next/CMakeLists.txt +++ b/next/CMakeLists.txt @@ -27,22 +27,16 @@ option(MBGL_WITH_CORE_ONLY "Build only the core bits, no platform code" OFF) option(MBGL_WITH_QT "Build Mapbox GL Qt bindings" OFF) option(MBGL_WITH_SANITIZER "Use [address|thread|memory|undefined] here" OFF) +# Compiler/linker configuration +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -Werror -Wall -Wextra -Wno-error=unknown-pragmas -Wno-error=deprecated-declarations") + set(CMAKE_CXX_FLAGS_DEBUGCOVERAGE "${CMAKE_CXX_FLAGS_DEBUG} --coverage") set(CMAKE_C_FLAGS_DEBUGCOVERAGE "${CMAKE_CXX_FLAGS_DEBUG} --coverage") set(CMAKE_CXX_FLAGS_SANITIZE "-DSANITIZE -g -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=${MBGL_WITH_SANITIZER}") set(CMAKE_C_FLAGS_SANITIZE "-DSANITIZE -g -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize=${MBGL_WITH_SANITIZER}") -if(MBGL_WITH_QT) - find_package(Qt5Core REQUIRED) - set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTORCC ON) -endif() - -# Avoid warnings when setting visibility cmake_policy(SET CMP0063 NEW) - -# Compiler/linker configuration set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -56,6 +50,12 @@ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) +if(MBGL_WITH_QT) + find_package(Qt5Core REQUIRED) + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTORCC ON) +endif() + add_library( mbgl-core STATIC ${MBGL_ROOT}/include/mbgl/actor/actor.hpp diff --git a/platform/android/src/test/render_test_collator.cpp b/platform/android/src/test/render_test_collator.cpp index e6e3b27b48..9c0e4bece5 100644 --- a/platform/android/src/test/render_test_collator.cpp +++ b/platform/android/src/test/render_test_collator.cpp @@ -10,9 +10,9 @@ public: Impl(bool caseSensitive_, bool diacriticSensitive_, optional) : caseSensitive(caseSensitive_), diacriticSensitive(diacriticSensitive_) {} - bool operator==(const Impl& other) const { return true; } + bool operator==(const Impl&) const { return true; } - int compare(const std::string& lhs, const std::string& rhs) const { return 0; } + int compare(const std::string&, const std::string&) const { return 0; } std::string resolvedLocale() const { return ""; } diff --git a/platform/darwin/src/MGLAccountManager.h b/platform/darwin/src/MGLAccountManager.h index 0d833a7ba7..d1983a4ddc 100644 --- a/platform/darwin/src/MGLAccountManager.h +++ b/platform/darwin/src/MGLAccountManager.h @@ -34,7 +34,7 @@ MGL_EXPORT and the type `String`. Alternatively, you may call this method from your application delegate’s `-applicationDidFinishLaunching:` method. */ -@property (class, nullable) NSString *accessToken; +@property (class, assign, nullable) NSString *accessToken; @end diff --git a/platform/darwin/src/MGLConversion.h b/platform/darwin/src/MGLConversion.h index d6de4151b9..3f7ffdd0c1 100644 --- a/platform/darwin/src/MGLConversion.h +++ b/platform/darwin/src/MGLConversion.h @@ -124,7 +124,7 @@ public: } } - static optional toGeoJSON(const Holder& holder, Error& error) { + static optional toGeoJSON(const Holder&, Error& error) { error = { "toGeoJSON not implemented" }; return {}; } diff --git a/platform/darwin/src/MGLStyleValue_Private.h b/platform/darwin/src/MGLStyleValue_Private.h index 82ce232c6b..b339dc8026 100644 --- a/platform/darwin/src/MGLStyleValue_Private.h +++ b/platform/darwin/src/MGLStyleValue_Private.h @@ -140,7 +140,7 @@ private: // Private utilities for converting from mgl to mbgl values class = typename std::enable_if::value>::type, typename MGLEnum = ObjCEnum, class = typename std::enable_if::value>::type> - NSObject* toRawStyleSpecValue(NSObject *rawMGLValue, MBGLEnum &mbglValue) { + NSObject* toRawStyleSpecValue(NSObject *rawMGLValue, MBGLEnum &) { if ([rawMGLValue isKindOfClass:[NSValue class]]) { const auto rawNSValue = (NSValue *)rawMGLValue; if (strcmp([rawNSValue objCType], @encode(CGVector)) == 0) { @@ -157,13 +157,13 @@ private: // Private utilities for converting from mgl to mbgl values class = typename std::enable_if::value>::type, typename MGLEnum = ObjCEnum, class = typename std::enable_if::value>::type> - NSString* toRawStyleSpecValue(ObjCType rawValue, MBGLEnum &mbglValue) { + NSString* toRawStyleSpecValue(ObjCType rawValue, MBGLEnum &) { MGLEnum mglEnum; [rawValue getValue:&mglEnum]; return @(mbgl::Enum::toString(mglEnum)); } - NSObject* toRawStyleSpecValue(MGLColor *color, MBGLType &mbglValue) { + NSObject* toRawStyleSpecValue(MGLColor *color, MBGLType &) { return @(color.mgl_color.stringify().c_str()); } diff --git a/render-test/metadata.hpp b/render-test/metadata.hpp index 567c89e3fc..2b007a445c 100644 --- a/render-test/metadata.hpp +++ b/render-test/metadata.hpp @@ -100,14 +100,14 @@ struct GfxProbe { GfxProbe() = default; GfxProbe(const mbgl::gfx::RenderingStats&, const GfxProbe&); - int numDrawCalls; - int numTextures; int numBuffers; + int numDrawCalls; int numFrameBuffers; + int numTextures; - Memory memTextures; Memory memIndexBuffers; Memory memVertexBuffers; + Memory memTextures; }; class TestMetrics { diff --git a/render-test/runner.cpp b/render-test/runner.cpp index 8a4b0b3b0e..0389b83575 100644 --- a/render-test/runner.cpp +++ b/render-test/runner.cpp @@ -1035,7 +1035,8 @@ bool TestRunner::runOperations(const std::string& key, TestMetadata& metadata, R map.flyTo(mbgl::CameraOptions().withCenter(endPos).withZoom(endZoom), animationOptions); - for (; !transitionFinished; frames++) { + while (!transitionFinished) { + frames++; frontend.renderOnce(map); float frameTime = (float)frontend.getFrameTime(); totalTime += frameTime; -- cgit v1.2.1