Skip to content
Snippets Groups Projects
Commit e924c3e6 authored by Administrator's avatar Administrator
Browse files

Fix compiler warnings when using Clang

The KF and L1 packages set special compiler flags. Some of the warnings are
not present when using Clang such that a CMake check was implemented which
test the existense of those. The check simply compiles some C++ code with the
compiler flag added to the compile command. Unfortunately Clang only prints a
warning when a warning flag doesn't exist but successfuly finishes the
compilation such that the check suceeds. This results in many warnings during
compilation of L1.
parent 95fad0f7
No related branches found
No related tags found
1 merge request!788Fix compiler warnings when using Clang
Pipeline #16789 failed
......@@ -122,22 +122,22 @@ Interface/CbmGlobalTrackFitterKF.h
#CbmKFParticleInterface.h
)
If (APPLE)
If(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ADD_DEFINITIONS(-Wall -Wsign-promo -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wno-parentheses -DDO_TPCCATRACKER_EFF_PERFORMANCE -DNonhomogeneousField -DCBM -DUSE_TIMERS) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root.
#---Check for compiler flags
CHECK_CXX_COMPILER_FLAG("-Wno-pmf-conversions" HAS_PMF)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-pmf-conversions" HAS_PMF)
If(HAS_PMF)
ADD_DEFINITIONS(-Wno-pmf-conversions)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wstrict-null-sentinel" HAS_SENTINEL)
CHECK_CXX_COMPILER_FLAG("-Werror -Wstrict-null-sentinel" HAS_SENTINEL)
If(HAS_SENTINEL)
ADD_DEFINITIONS(-Wstrict-null-sentinel)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
If(HAS_TEMPLATE_FRIEND)
ADD_DEFINITIONS(-Wno-non-template-friend)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wno-pragmas" HAS_PRAGMA)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-pragmas" HAS_PRAGMA)
If(HAS_PRAGMA)
ADD_DEFINITIONS(-Wno-pragmas)
EndIf()
......
......@@ -65,22 +65,22 @@ CbmKFParticleFinderQa.h
CbmKFParticleInterface.h
)
If (APPLE)
If(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ADD_DEFINITIONS(-Wall -Wsign-promo -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wno-parentheses -DDO_TPCCATRACKER_EFF_PERFORMANCE -DNonhomogeneousField -DCBM -DUSE_TIMERS) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root.
#---Check for compiler flags
CHECK_CXX_COMPILER_FLAG("-Wno-pmf-conversions" HAS_PMF)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-pmf-conversions" HAS_PMF)
If(HAS_PMF)
ADD_DEFINITIONS(-Wno-pmf-conversions)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wstrict-null-sentinel" HAS_SENTINEL)
CHECK_CXX_COMPILER_FLAG("-Werror -Wstrict-null-sentinel" HAS_SENTINEL)
If(HAS_SENTINEL)
ADD_DEFINITIONS(-Wstrict-null-sentinel)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
If(HAS_TEMPLATE_FRIEND)
ADD_DEFINITIONS(-Wno-non-template-friend)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wno-pragmas" HAS_PRAGMA)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-pragmas" HAS_PRAGMA)
If(HAS_PRAGMA)
ADD_DEFINITIONS(-Wno-pragmas)
EndIf()
......@@ -89,12 +89,12 @@ Else()
EndIf()
IF (SSE_FOUND)
Message(STATUS "KF will be compiled with SSE support")
Message(STATUS "KFParticleInterface will be compiled with SSE support")
ADD_DEFINITIONS(-DHAVE_SSE)
SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
"-msse -O3")
ELSE (SSE_FOUND)
MESSAGE(STATUS "KF will be compiled without SSE support")
MESSAGE(STATUS "KFParticleInterface will be compiled without SSE support")
SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
"-O3")
ENDIF (SSE_FOUND)
......
......@@ -66,22 +66,22 @@ KFQA/CbmKFPartEfficiencies.h
KFQA/KFParticleMatch.h
)
If (APPLE)
If(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ADD_DEFINITIONS(-Wall -Wsign-promo -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wno-parentheses -DDO_TPCCATRACKER_EFF_PERFORMANCE -DNonhomogeneousField -DCBM -DUSE_TIMERS) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root.
#---Check for compiler flags
CHECK_CXX_COMPILER_FLAG("-Wno-pmf-conversions" HAS_PMF)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-pmf-conversions" HAS_PMF)
If(HAS_PMF)
ADD_DEFINITIONS(-Wno-pmf-conversions)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wstrict-null-sentinel" HAS_SENTINEL)
CHECK_CXX_COMPILER_FLAG("-Werror -Wstrict-null-sentinel" HAS_SENTINEL)
If(HAS_SENTINEL)
ADD_DEFINITIONS(-Wstrict-null-sentinel)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
If(HAS_TEMPLATE_FRIEND)
ADD_DEFINITIONS(-Wno-non-template-friend)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wno-pragmas" HAS_PRAGMA)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-pragmas" HAS_PRAGMA)
If(HAS_PRAGMA)
ADD_DEFINITIONS(-Wno-pragmas)
EndIf()
......@@ -90,12 +90,12 @@ Else()
EndIf()
IF (SSE_FOUND)
Message(STATUS "KF will be compiled with SSE support")
Message(STATUS "KFQA will be compiled with SSE support")
ADD_DEFINITIONS(-DHAVE_SSE)
SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
"-msse -O3")
ELSE (SSE_FOUND)
MESSAGE(STATUS "KF will be compiled without SSE support")
MESSAGE(STATUS "KFQA will be compiled without SSE support")
SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
"-O3")
ENDIF (SSE_FOUND)
......
......@@ -190,27 +190,23 @@ qa/CbmTrackerInputQaTrd.h
If(APPLE)
If(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ADD_DEFINITIONS(-Wall -Wsign-promo -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wno-parentheses) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root.
#-- - Check for compiler flags
CHECK_CXX_COMPILER_FLAG("-Wno-pmf-conversions" HAS_PMF)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-pmf-conversions" HAS_PMF)
If(HAS_PMF)
ADD_DEFINITIONS(-Wno-pmf-conversions)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wstrict-null-sentinel" HAS_SENTINEL)
CHECK_CXX_COMPILER_FLAG("-Werror -Wstrict-null-sentinel" HAS_SENTINEL)
If(HAS_SENTINEL)
ADD_DEFINITIONS(-Wstrict-null-sentinel)
EndIf()
CHECK_CXX_COMPILER_FLAG("-Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
CHECK_CXX_COMPILER_FLAG("-Werror -Wno-non-template-friend" HAS_TEMPLATE_FRIEND)
If(HAS_TEMPLATE_FRIEND)
ADD_DEFINITIONS(-Wno-non-template-friend)
EndIf()
Else()
ADD_DEFINITIONS(-Wall -Wsign-promo -Wno-pmf-conversions -Wctor-dtor-privacy -Wreorder -Wno-deprecated -Wstrict-null-sentinel -Wno-non-template-friend -Wno-parentheses) # -Weffc++ -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast : wait for other parts of cbmroot\root.
EndIf()
......
......@@ -79,9 +79,9 @@ IF (SSE_FOUND)
ADD_DEFINITIONS(-DHAVE_SSE)
SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
"-msse -O3")
Message(STATUS "L1 will be compiled with SSE support")
Message(STATUS "eventbuilder will be compiled with SSE support")
ELSE (SSE_FOUND)
Message(STATUS "L1 will be compiled without SSE support")
Message(STATUS "eventbuilder will be compiled without SSE support")
SET_SOURCE_FILES_PROPERTIES(${SRCS} PROPERTIES COMPILE_FLAGS
"-O3")
ENDIF (SSE_FOUND)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment