From 6b95f90b66fa27dbe3a3c971c13b7672ded32f6c Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Fri, 14 Jul 2017 14:29:43 +0300 Subject: [PATCH] Review fixes. --- 3party/freetype/CMakeLists.txt | 8 +++----- 3party/icu/CMakeLists.txt | 8 +++----- 3party/liboauthcpp/CMakeLists.txt | 8 +++----- 3party/minizip/CMakeLists.txt | 8 +++----- 3party/osrm/CMakeLists.txt | 8 +++----- 3party/protobuf/CMakeLists.txt | 10 ++++------ 3party/sdf_image/CMakeLists.txt | 8 +++----- 3party/succinct/CMakeLists.txt | 6 ------ CMakeLists.txt | 8 ++++++++ map/framework.cpp | 2 +- ugc/api.cpp | 2 +- ugc/api.hpp | 2 +- 12 files changed, 33 insertions(+), 45 deletions(-) diff --git a/3party/freetype/CMakeLists.txt b/3party/freetype/CMakeLists.txt index 2d381461ce..ebdf9808b9 100644 --- a/3party/freetype/CMakeLists.txt +++ b/3party/freetype/CMakeLists.txt @@ -10,11 +10,9 @@ add_compile_options( "-Wall" ) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-unused-function" - ) -endif() +add_clang_compile_options( + "-Wno-unused-function" +) include_directories(include) diff --git a/3party/icu/CMakeLists.txt b/3party/icu/CMakeLists.txt index c2fcce02f7..ce5f6dd29c 100644 --- a/3party/icu/CMakeLists.txt +++ b/3party/icu/CMakeLists.txt @@ -10,11 +10,9 @@ add_definitions( -DU_ENABLE_DYLOAD=0 ) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-deprecated-declarations" - ) -endif() +add_clang_compile_options( + "-Wno-deprecated-declarations" +) set(CMAKE_PREFIX_PATH ./) diff --git a/3party/liboauthcpp/CMakeLists.txt b/3party/liboauthcpp/CMakeLists.txt index a1e07791b1..12546541f8 100644 --- a/3party/liboauthcpp/CMakeLists.txt +++ b/3party/liboauthcpp/CMakeLists.txt @@ -2,11 +2,9 @@ project(oauthcpp) include_directories(include src) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-shorten-64-to-32" - ) -endif() +add_clang_compile_options( + "-Wno-shorten-64-to-32" +) set( SRC diff --git a/3party/minizip/CMakeLists.txt b/3party/minizip/CMakeLists.txt index d4c412a473..b1c763870d 100644 --- a/3party/minizip/CMakeLists.txt +++ b/3party/minizip/CMakeLists.txt @@ -2,11 +2,9 @@ project(minizip) add_definitions(-DUSE_FILE32ZPI -DNOCRYPT) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-unused-value" - ) -endif() +add_clang_compile_options( + "-Wno-unused-value" +) set( SRC diff --git a/3party/osrm/CMakeLists.txt b/3party/osrm/CMakeLists.txt index e671083b14..e24c9557be 100644 --- a/3party/osrm/CMakeLists.txt +++ b/3party/osrm/CMakeLists.txt @@ -6,11 +6,9 @@ include_directories( ${OMIM_ROOT}/3party/osrm/osrm-backend/third_party ) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-overloaded-virtual" - ) -endif() +add_clang_compile_options( + "-Wno-overloaded-virtual" +) set( SRC diff --git a/3party/protobuf/CMakeLists.txt b/3party/protobuf/CMakeLists.txt index b1e48d3ea5..6aabf86543 100644 --- a/3party/protobuf/CMakeLists.txt +++ b/3party/protobuf/CMakeLists.txt @@ -6,12 +6,10 @@ if (NOT PLATFORM_WIN) add_definitions(-DHAVE_PTHREAD) endif () -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-deprecated-declarations" - "-Wno-shorten-64-to-32" - ) -endif() +add_clang_compile_options( + "-Wno-deprecated-declarations" + "-Wno-shorten-64-to-32" +) set( SRC diff --git a/3party/sdf_image/CMakeLists.txt b/3party/sdf_image/CMakeLists.txt index d6717b2327..83c8cf416f 100644 --- a/3party/sdf_image/CMakeLists.txt +++ b/3party/sdf_image/CMakeLists.txt @@ -1,10 +1,8 @@ project(sdf_image) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-shorten-64-to-32" - ) -endif() +add_clang_compile_options( + "-Wno-shorten-64-to-32" +) set( SRC diff --git a/3party/succinct/CMakeLists.txt b/3party/succinct/CMakeLists.txt index 9f336d3f33..30ee3eedf5 100644 --- a/3party/succinct/CMakeLists.txt +++ b/3party/succinct/CMakeLists.txt @@ -4,12 +4,6 @@ add_definitions(-DLTC_NO_ROLC) include_directories(src/headers) -if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options( - "-Wno-unused-local-typedef" - ) -endif() - set( SRC bit_vector.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index f02a230620..ac8cedcea4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -262,6 +262,14 @@ function(link_qt5_network target) ) endfunction() +function(add_clang_compile_options options) + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options( + ${options} + ) + endif() +endfunction() + # End of functions for subdirectories set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff --git a/map/framework.cpp b/map/framework.cpp index 00a533083d..497db219c6 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1484,7 +1484,7 @@ void Framework::InitUGC() { ASSERT(!m_ugcApi.get(), ("InitUGC() must be called only once.")); - m_ugcApi = make_unique(m_model.GetIndex(), "FILENAME_PLACEHOLDER"); + m_ugcApi = make_unique("FILENAME_PLACEHOLDER"); } void Framework::InitSearchEngine() diff --git a/ugc/api.cpp b/ugc/api.cpp index 866ff079ac..7ef72cc9ed 100644 --- a/ugc/api.cpp +++ b/ugc/api.cpp @@ -17,7 +17,7 @@ Time FromDaysAgo(Time time, uint32_t days) } } // namespace -Api::Api(Index const & index, std::string const & filename) : m_storage(filename) {} +Api::Api(std::string const & filename) : m_storage(filename) {} void Api::GetUGC(FeatureID const & id, UGCCallback callback) { diff --git a/ugc/api.hpp b/ugc/api.hpp index 3a2b4220ec..45525f76e5 100644 --- a/ugc/api.hpp +++ b/ugc/api.hpp @@ -18,7 +18,7 @@ public: using UGCCallback = std::function; using UGCUpdateCallback = std::function; - explicit Api(Index const & index, std::string const & filename); + explicit Api(std::string const & filename); void GetUGC(FeatureID const & id, UGCCallback callback); void GetUGCUpdate(FeatureID const & id, UGCUpdateCallback callback);