summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-08-18 11:45:11 +0200
committerGitHub <noreply@github.com>2020-08-18 11:45:11 +0200
commitad498f69b572fb53d26424cb03ad45589acfc17f (patch)
tree19c84f278fac5b3a5321a778389bb4ddb74c01b9
parentd1667a72cef5dd22fb57fa588b44716292997546 (diff)
parentc969b7e7a601cf9507ab0684d7eed22bb2f706df (diff)
Merge pull request #14078 from vespa-engine/toregge/consolidate-suppress-warnings-for-protobuf-sources
Consolidate suppress warnings for protobuf sources.
-rw-r--r--functions.cmake20
-rw-r--r--logd/src/logd/CMakeLists.txt5
-rw-r--r--searchlib/src/vespa/searchlib/engine/CMakeLists.txt6
-rw-r--r--storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt7
4 files changed, 24 insertions, 14 deletions
diff --git a/functions.cmake b/functions.cmake
index 864fc010faa..95828430768 100644
--- a/functions.cmake
+++ b/functions.cmake
@@ -710,3 +710,23 @@ endfunction()
function(vespa_install_empty_tmp_dir TARGET)
install(DIRECTORY DESTINATION ${TARGET} DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_WRITE GROUP_EXECUTE WORLD_READ WORLD_WRITE WORLD_EXECUTE SETGID)
endfunction()
+
+function(vespa_suppress_warnings_for_protobuf_sources)
+ cmake_parse_arguments(
+ ARG
+ ""
+ ""
+ "SOURCES"
+ ${ARGN}
+ )
+ # protoc-generated files emit compiler warnings that we normally treat as errors.
+ # Instead of rolling our own compiler plugin we'll pragmatically disable the noise.
+ if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
+ if(Protobuf_VERSION VERSION_LESS "3.7.0")
+ set(VESPA_DISABLE_UNUSED_WARNING "-Wno-unused-parameter")
+ else()
+ unset(VESPA_DISABLE_UNUSED_WARNING)
+ endif()
+ set_source_files_properties(${ARG_SOURCES} PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override -Wno-inline ${VESPA_DISABLE_UNUSED_WARNING}")
+ endif()
+endfunction()
diff --git a/logd/src/logd/CMakeLists.txt b/logd/src/logd/CMakeLists.txt
index 92f70ef9102..cc73b51f0b1 100644
--- a/logd/src/logd/CMakeLists.txt
+++ b/logd/src/logd/CMakeLists.txt
@@ -8,10 +8,7 @@ protobuf_generate_cpp(logd_PROTOBUF_SRCS logd_PROTOBUF_HDRS ../../../logserver/s
vespa_add_source_target(protobufgen_logd DEPENDS ${logd_PROTOBUF_SRCS} ${logd_PROTOBUF_HDRS})
-# protoc-generated files emit compiler warnings that we normally treat as errors.
-if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
- set_source_files_properties(${logd_PROTOBUF_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override")
-endif()
+vespa_suppress_warnings_for_protobuf_sources(SOURCES ${logd_PROTOBUF_SRCS})
vespa_add_library(logd STATIC
SOURCES
diff --git a/searchlib/src/vespa/searchlib/engine/CMakeLists.txt b/searchlib/src/vespa/searchlib/engine/CMakeLists.txt
index 082af18d32b..570118de0af 100644
--- a/searchlib/src/vespa/searchlib/engine/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/engine/CMakeLists.txt
@@ -5,11 +5,7 @@ protobuf_generate_cpp(searchlib_engine_PROTOBUF_SRCS searchlib_engine_PROTOBUF_H
vespa_add_source_target(protobufgen_searchlib_engine DEPENDS ${searchlib_engine_PROTOBUF_SRCS} ${searchlib_engine_PROTOBUF_HDRS})
-# protoc-generated files emit compiler warnings that we normally treat as errors.
-if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
- set_source_files_properties(${searchlib_engine_PROTOBUF_SRCS}
- PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override")
-endif()
+vespa_suppress_warnings_for_protobuf_sources(SOURCES ${searchlib_engine_PROTOBUF_SRCS})
vespa_add_library(searchlib_engine OBJECT
SOURCES
diff --git a/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt b/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt
index 1b1e224f034..b749844775d 100644
--- a/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt
+++ b/storageapi/src/vespa/storageapi/mbusprot/CMakeLists.txt
@@ -9,11 +9,8 @@ PROTOBUF_GENERATE_CPP(storageapi_PROTOBUF_SRCS storageapi_PROTOBUF_HDRS
vespa_add_source_target(protobufgen_storageapi_mbusprot DEPENDS ${storageapi_PROTOBUF_SRCS} ${storageapi_PROTOBUF_HDRS})
-# protoc-generated files emit compiler warnings that we normally treat as errors.
-# Instead of rolling our own compiler plugin we'll pragmatically disable the noise.
-if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
- set_source_files_properties(${storageapi_PROTOBUF_SRCS} PROPERTIES COMPILE_FLAGS "-Wno-array-bounds -Wno-suggest-override -Wno-inline")
-endif()
+vespa_suppress_warnings_for_protobuf_sources(SOURCES ${storageapi_PROTOBUF_SRCS})
+
# protoc explicitly annotates methods with inline, which triggers -Werror=inline when
# the header file grows over a certain size.
set_source_files_properties(protocolserialization7.cpp PROPERTIES COMPILE_FLAGS "-Wno-inline")