Skip to content

Commit

Permalink
MDEV-19740: Have MYSQL_MAINTAINER_MODE only enable -Werror
Browse files Browse the repository at this point in the history
Let us enable all GCC and clang warnings independently of the
MYSQL_MAINTAINER_MODE setting for both Debug and RelWithDebInfo
builds, and have MYSQL_MAINTAINER_MODE only enable -Werror.

The default setting of MYSQL_MAINTAINER_MODE=AUTO will continue
to apply the -Werror only to CMAKE_BUILD_TYPE=Debug. To build
a debug version without -Werror, MYSQL_MAINTAINER_MODE=OFF can
be used.
  • Loading branch information
dr-m committed Apr 1, 2020
1 parent f813131 commit 31eaa20
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions cmake/maintainer.cmake
@@ -1,4 +1,5 @@
# Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2020, MariaDB
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -28,11 +29,16 @@ SET(MY_WARNING_FLAGS
-Woverloaded-virtual
-Wvla
-Wwrite-strings
-Werror
)

FOREACH(F ${MY_WARNING_FLAGS})
MY_CHECK_AND_SET_COMPILER_FLAG(${F} DEBUG RELWITHDEBINFO)
ENDFOREACH()

SET(MY_ERROR_FLAGS -Werror)

IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wno-error=maybe-uninitialized)
SET(MY_ERROR_FLAGS ${MY_ERROR_FLAGS} -Wno-error=maybe-uninitialized)
ENDIF()

IF(MYSQL_MAINTAINER_MODE MATCHES "OFF")
Expand All @@ -41,7 +47,7 @@ ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(WHERE DEBUG)
ENDIF()

FOREACH(F ${MY_WARNING_FLAGS})
FOREACH(F ${MY_ERROR_FLAGS})
MY_CHECK_AND_SET_COMPILER_FLAG(${F} ${WHERE})
ENDFOREACH()

Expand Down

0 comments on commit 31eaa20

Please sign in to comment.