Enforce consistent function prototypes

This commit is contained in:
Carles Fernandez 2021-01-04 13:55:18 +01:00
parent 867f53a49e
commit cbdb2ad2e9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
1 changed files with 17 additions and 0 deletions

View File

@ -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)