From cbdb2ad2e92958094972ae976b2829cdeb6f1844 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Mon, 4 Jan 2021 13:55:18 +0100 Subject: [PATCH] Enforce consistent function prototypes --- .../volk_gnsssdr/CMakeLists.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt index 3df149278..5b69ce569 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/CMakeLists.txt @@ -151,6 +151,10 @@ if(NOT ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND NOT WIN32) AND NOT (CMAKE_CXX endif() endif() +######################################################################## +# Common compile flags +######################################################################## + # Disable complex math NaN/INFO range checking for performance include(CheckCXXCompilerFlag) check_cxx_compiler_flag(-fcx-limited-range HAVE_CX_LIMITED_RANGE) @@ -167,6 +171,19 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_FLAGS} -Wall") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") +if(CMAKE_C_COMPILER_ID MATCHES "Clang|GNU") + # Abort compilation if kernel implementations have inconsistent function + # prototypes, i.e. if + # + # kernel_foo_sse(uint32_t *dst, lv32fc_t *src) + # kernel_foo_avx(uint16_t *dst, lv32fc_t *src) + # + # are defined. Note the different data type of the first argument). By + # default 'incompatible-pointer-types' is a warning only and 'pointer-sign' + # is a warning enabled by '-Wall'. These warnings are only applicable to C. + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=incompatible-pointer-types -Werror=pointer-sign") +endif() + option(ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without debugging symbols)" OFF) if(ENABLE_STRIP) set(CMAKE_VERBOSE_MAKEFILE ON)