summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <tmpsantos@gmail.com>2019-11-05 13:54:30 +0200
committerThiago Marcos P. Santos <tmpsantos@gmail.com>2019-11-15 23:38:47 +0200
commitf73467786dff98fa2f7240c9a775dff047b29bbf (patch)
tree97b2d076ef90b3118d8357460358bb834ee18784
parent4c1d03c257754ecc1555f3e31b3c6ccf45c4bf7b (diff)
downloadqtlocation-mapboxgl-f73467786dff98fa2f7240c9a775dff047b29bbf.tar.gz
[build] Enable more warnings on the next build
Make compilation more pedantic.
-rw-r--r--next/CMakeLists.txt27
-rw-r--r--platform/android/src/test/render_test_collator.cpp14
-rw-r--r--platform/darwin/src/MGLAccountManager.h2
-rw-r--r--platform/darwin/src/MGLConversion.h2
-rw-r--r--platform/darwin/src/MGLStyleValue_Private.h6
5 files changed, 27 insertions, 24 deletions
diff --git a/next/CMakeLists.txt b/next/CMakeLists.txt
index 5ba734f481..c9d07fd5f3 100644
--- a/next/CMakeLists.txt
+++ b/next/CMakeLists.txt
@@ -28,21 +28,24 @@ option(MBGL_WITH_QT "Build Mapbox GL Qt bindings" OFF)
option(MBGL_WITH_SANITIZER "Use [address|thread|memory|undefined] here" OFF)
set(CMAKE_CXX_FLAGS_DEBUGCOVERAGE "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
-set(CMAKE_C_FLAGS_DEBUGCOVERAGE "${CMAKE_CXX_FLAGS_DEBUG} --coverage")
+set(CMAKE_C_FLAGS_DEBUGCOVERAGE "${CMAKE_C_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()
+add_compile_options(
+ $<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>
+ $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>>:-Wall>
+ $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>>:-Wextra>
+ $<$<AND:$<COMPILE_LANGUAGE:CXX>,$<NOT:$<PLATFORM_ID:Windows>>>:-Werror>
+ $<$<CXX_COMPILER_ID:GNU>:-Wno-error=maybe-uninitialized>
+ $<$<CXX_COMPILER_ID:GNU>:-Wno-error=unknown-pragmas>
+ $<$<CXX_COMPILER_ID:AppleClang>:-Wno-error=deprecated-declarations>
+ $<$<CXX_COMPILER_ID:AppleClang>:-Wno-error=unused-parameter>
+ $<$<CXX_COMPILER_ID:AppleClang>:-Wno-error=unused-property-ivar>
+)
-# 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 +59,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..7c83318979 100644
--- a/platform/android/src/test/render_test_collator.cpp
+++ b/platform/android/src/test/render_test_collator.cpp
@@ -7,22 +7,16 @@ namespace platform {
class Collator::Impl {
public:
- Impl(bool caseSensitive_, bool diacriticSensitive_, optional<std::string>)
- : caseSensitive(caseSensitive_), diacriticSensitive(diacriticSensitive_) {}
+ Impl(optional<std::string>) {}
- 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 ""; }
-
-private:
- bool caseSensitive;
- bool diacriticSensitive;
};
-Collator::Collator(bool caseSensitive, bool diacriticSensitive, optional<std::string> locale_)
- : impl(std::make_shared<Impl>(caseSensitive, diacriticSensitive, std::move(locale_))) {}
+Collator::Collator(bool, bool, optional<std::string> locale_) : impl(std::make_shared<Impl>(std::move(locale_))) {}
int Collator::compare(const std::string& lhs, const std::string& rhs) const {
return impl->compare(lhs, rhs);
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<GeoJSON> toGeoJSON(const Holder& holder, Error& error) {
+ static optional<GeoJSON> 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 07dbd31238..43f0b9d282 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<!std::is_enum<MBGLEnum>::value>::type,
typename MGLEnum = ObjCEnum,
class = typename std::enable_if<!std::is_enum<MGLEnum>::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<std::is_enum<MBGLEnum>::value>::type,
typename MGLEnum = ObjCEnum,
class = typename std::enable_if<std::is_enum<MGLEnum>::value>::type>
- NSString* toRawStyleSpecValue(ObjCType rawValue, MBGLEnum &mbglValue) {
+ NSString* toRawStyleSpecValue(ObjCType rawValue, MBGLEnum &) {
MGLEnum mglEnum;
[rawValue getValue:&mglEnum];
return @(mbgl::Enum<MGLEnum>::toString(mglEnum));
}
- NSObject* toRawStyleSpecValue(MGLColor *color, MBGLType &mbglValue) {
+ NSObject* toRawStyleSpecValue(MGLColor *color, MBGLType &) {
return @(color.mgl_color.stringify().c_str());
}