Commit f91c8b71 authored by Jan Möbius's avatar Jan Möbius

enable more clang warnings

parent 6e14f292
Pipeline #10607 canceled with stage
in 55 seconds
...@@ -19,7 +19,7 @@ if ( WIN32 ) ...@@ -19,7 +19,7 @@ if ( WIN32 )
list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_EXE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_SHARED_LINKER_FLAGS "/LARGEADDRESSAWARE" )
list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" ) list(APPEND ADDITIONAL_CMAKE_MODULE_LINKER_FLAGS "/LARGEADDRESSAWARE" )
endif() endif()
endif() endif()
...@@ -45,10 +45,12 @@ endif( WIN32 ) ...@@ -45,10 +45,12 @@ endif( WIN32 )
if (UNIX) if (UNIX)
set ( ADDITIONAL_CXX_FLAGS )
set ( ADDITIONAL_CXX_DEBUG_FLAGS ) set ( ADDITIONAL_CXX_DEBUG_FLAGS )
set ( ADDITIONAL_CXX_RELEASE_FLAGS ) set ( ADDITIONAL_CXX_RELEASE_FLAGS )
set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ) set ( ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS )
set ( ADDITIONAL_C_FLAGS )
set ( ADDITIONAL_C_DEBUG_FLAGS ) set ( ADDITIONAL_C_DEBUG_FLAGS )
set ( ADDITIONAL_C_RELEASE_FLAGS ) set ( ADDITIONAL_C_RELEASE_FLAGS )
set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS ) set ( ADDITIONAL_C_RELWITHDEBINFO_FLAGS )
...@@ -58,19 +60,13 @@ if (UNIX) ...@@ -58,19 +60,13 @@ if (UNIX)
################################################################################ ################################################################################
# add our standard flags for Template inclusion # add our standard flags for Template inclusion
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" ) list(APPEND ADDITIONAL_CXX_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" ) list(APPEND ADDITIONAL_C_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
# add our standard flags for Template inclusion
list(APPEND ADDITIONAL_C_DEBUG_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELEASE_FLAGS "-DINCLUDE_TEMPLATES" )
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS "-DINCLUDE_TEMPLATES" )
################################################################################ ################################################################################
# OS Defines # OS Defines
################################################################################ ################################################################################
if (APPLE) if (APPLE)
add_definitions( -DARCH_DARWIN ) add_definitions( -DARCH_DARWIN )
endif() endif()
...@@ -91,7 +87,7 @@ if (UNIX) ...@@ -91,7 +87,7 @@ if (UNIX)
################################################################################ ################################################################################
# Warnings # Warnings
################################################################################ ################################################################################
# Add the standard compiler warnings # Add the standard compiler warnings
if ( NOT COMPILER_WARNINGS ) if ( NOT COMPILER_WARNINGS )
...@@ -104,18 +100,27 @@ if (UNIX) ...@@ -104,18 +100,27 @@ if (UNIX)
set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " ) set ( COMPILER_WARNINGS "" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ELSE () ELSE ()
set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " ) set ( COMPILER_WARNINGS "-W" "-Wall" "-Wno-unused" "-Wextra" "-Wno-variadic-macros" CACHE STRINGLIST "This list contains the warning flags used during compilation " )
ENDIF() ENDIF()
endif ( NOT COMPILER_WARNINGS ) endif ( NOT COMPILER_WARNINGS )
list(APPEND ADDITIONAL_CXX_DEBUG_FLAGS ${COMPILER_WARNINGS} ) list(APPEND ADDITIONAL_CXX_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELEASE_FLAGS ${COMPILER_WARNINGS} ) list(APPEND ADDITIONAL_C_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} )
list(APPEND ADDITIONAL_C_DEBUG_FLAGS ${COMPILER_WARNINGS} ) if ("${CMAKE_CXX_COMPILER}" MATCHES ".*clang.*")
list(APPEND ADDITIONAL_C_RELEASE_FLAGS ${COMPILER_WARNINGS} ) list(APPEND ADDITIONAL_CXX_FLAGS "-Weverything")
list(APPEND ADDITIONAL_C_RELWITHDEBINFO_FLAGS ${COMPILER_WARNINGS} ) # list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-c++98-compat")
# list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-padded")
# list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-old-style-cast")
# list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-documentation-unknown-command")
# list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-unreachable-code-return")
# enable later:
# list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-sign-conversion")
# list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-deprecated")
# list(APPEND ADDITIONAL_CXX_FLAGS "-Wno-weak-vtables")
endif()
################################################################################ ################################################################################
# STL Vector checks # STL Vector checks
################################################################################ ################################################################################
...@@ -147,43 +152,49 @@ if (UNIX) ...@@ -147,43 +152,49 @@ if (UNIX)
################################################################################ ################################################################################
# Add the debug flags # Add the debug flags
foreach( flag ${ADDITIONAL_CXX_DEBUG_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_DEBUG_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_DEBUG MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ") set( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release flags # Add the release flags
foreach( flag ${ADDITIONAL_CXX_RELEASE_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELEASE_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELEASE MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ") set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release with debug info flags # Add the release with debug info flags
foreach( flag ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} ) foreach( flag ${ADDITIONAL_CXX_FLAGS} ${ADDITIONAL_CXX_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) list (FIND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ") set( CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the debug flags # Add the debug flags
foreach( flag ${ADDITIONAL_C_DEBUG_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_DEBUG_FLAGS} )
if( NOT CMAKE_C_FLAGS_DEBUG MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_DEBUG} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ") set( CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release flags # Add the release flags
foreach( flag ${ADDITIONAL_C_RELEASE_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELEASE_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELEASE MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_RELEASE} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ") set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${flag} ")
endif() endif()
endforeach() endforeach()
# Add the release with debug info flags # Add the release with debug info flags
foreach( flag ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} ) foreach( flag ${ADDITIONAL_C_FLAGS} ${ADDITIONAL_C_RELWITHDEBINFO_FLAGS} )
if( NOT CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "${flag}" ) list (FIND ${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} _index)
if (${_index} EQUAL -1)
set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ") set( CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} ${flag} ")
endif() endif()
endforeach() endforeach()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment