summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt13
-rw-r--r--config/ac-macros/maintainer.m41
2 files changed, 12 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c349813f68..544c48f79f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,18 +115,27 @@ ENDIF()
# Control aspects of the development environment which are
# specific to MySQL maintainers and developers.
#
+INCLUDE (CheckCCompilerFlag)
OPTION(MYSQL_MAINTAINER_MODE "MySQL maintainer-specific development environment" OFF)
# Whether the maintainer mode should be enabled.
IF(MYSQL_MAINTAINER_MODE)
IF(CMAKE_COMPILER_IS_GNUCC)
+ CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAVE_DECLARATION_AFTER_STATEMENT)
+ IF(HAVE_DECLARATION_AFTER_STATEMENT)
+ SET(MY_MAINTAINER_DECLARATION_AFTER_STATEMENT "-Wdeclaration-after-statement")
+ ENDIF()
SET(MY_MAINTAINER_C_WARNINGS
- "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror"
- CACHE STRING "C warning options used in maintainer builds.")
+ "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_C_WARNINGS} -Wno-unused-parameter"
CACHE STRING "C++ warning options used in maintainer builds.")
ENDIF()
+ IF(CMAKE_COMPILER_IS_GNUCC)
+ SET(MY_MAINTAINER_C_WARNINGS
+ "${MY_MAINTAINER_C_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}"
+ CACHE STRING "C warning options used in maintainer builds.")
+ ENDIF()
# Do not make warnings in checks into errors.
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX)
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error")
diff --git a/config/ac-macros/maintainer.m4 b/config/ac-macros/maintainer.m4
index 5960853d7f1..b4d2f08e558 100644
--- a/config/ac-macros/maintainer.m4
+++ b/config/ac-macros/maintainer.m4
@@ -19,6 +19,7 @@ AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [
AS_IF([test "$GCC" = "yes"], [
C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror"
CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter"
+ C_WARNINGS="${C_WARNINGS} -Wdeclaration-after-statement"
])
# Test whether the warning options work.