mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
MDEV-36542: apply clang -Werror=uninitialized to catch dubious initializations
clang has rather correct error detection in its implementation of the -Werror=uninitialized* set of C/CXX flags. Use them by default.
This commit is contained in:
@@ -68,6 +68,14 @@ IF(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS
|
||||
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=non-virtual-dtor) # gcc bug 7302
|
||||
ENDIF()
|
||||
|
||||
FOREACH(LANG C CXX)
|
||||
IF(CMAKE_${LANG}_COMPILER_ID MATCHES "Clang")
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG(-Werror=uninitialized-explicit-init)
|
||||
MY_CHECK_AND_SET_COMPILER_FLAG(-Werror=uninitialized-const-reference)
|
||||
SET(CMAKE_${LANG}_FLAGS "${CMAKE_${LANG}_FLAGS} -Werror=uninitialized")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
IF(MYSQL_MAINTAINER_MODE MATCHES "OFF|WARN")
|
||||
RETURN()
|
||||
ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
|
||||
|
||||
Reference in New Issue
Block a user