List:Commits« Previous MessageNext Message »
From:Davi Arnaut Date:July 9 2010 1:06am
Subject:bzr commit into mysql-5.1-bugteam branch (davi:3470) Bug#53445
View as plain text  
# At a local mysql-5.1-bugteam repository of davi

 3470 Davi Arnaut	2010-07-08
      Bug#53445: Build with -Wall and fix warnings that it generates
      
      Introduce a MySQL maintainer/developer mode that enables
      a set of warning options for the C/C++ compiler. This mode
      is intended to help improve the overall quality of the code.
      
      The warning options are:
      
      C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror"
      CXX_WARNINGS="$C_WARNINGS -Wno-unused-parameter"
     @ config/ac-macros/maintainer.m4
        Add a set of default compiler flags used when in maintainer mode.
     @ configure.in
        Hook into the maintainer mode. Disabled by default.

    added:
      config/ac-macros/maintainer.m4
    modified:
      configure.in
=== added file 'config/ac-macros/maintainer.m4'
--- a/config/ac-macros/maintainer.m4	1970-01-01 00:00:00 +0000
+++ b/config/ac-macros/maintainer.m4	2010-07-09 01:05:56 +0000
@@ -0,0 +1,66 @@
+#
+# Control aspects of the development environment which are
+# specific to MySQL maintainers and developers.
+#
+AC_DEFUN([MY_MAINTAINER_MODE], [
+  AC_MSG_CHECKING([whether to enable the maintainer-specific development environment])
+  AC_ARG_ENABLE([mysql-maintainer-mode],
+    [AS_HELP_STRING([--enable-mysql-maintainer-mode],
+                    [Enable a MySQL maintainer-specific development environment])],
+    [USE_MYSQL_MAINTAINER_MODE=$enableval],
+    [USE_MYSQL_MAINTAINER_MODE=no])
+  AC_MSG_RESULT([$USE_MYSQL_MAINTAINER_MODE])
+])
+
+# Set warning options required under maintainer mode.
+AC_DEFUN([MY_MAINTAINER_MODE_WARNINGS], [
+  # Setup GCC warning options.
+  AS_IF([test "$GCC" = "yes"], [
+    C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Werror"
+    CXX_WARNINGS="${C_WARNINGS} -Wno-unused-parameter"
+  ])
+
+  # Test whether the warning options work.
+  # Test C options
+  AS_IF([test -n "$C_WARNINGS"], [
+    save_CFLAGS="$CFLAGS"
+    AC_MSG_CHECKING([whether to use C warning options ${C_WARNINGS}])
+    AC_LANG_PUSH(C)
+    CFLAGS="$CFLAGS ${C_WARNINGS}"
+    AC_LANG_WERROR
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_c_warning_flags=yes],
+                      [myac_c_warning_flags=no])
+    AC_LANG_POP()
+    AC_MSG_RESULT([$myac_c_warning_flags])
+    CFLAGS="$save_CFLAGS"
+  ])
+
+  # Test C++ options
+  AS_IF([test -n "$CXX_WARNINGS"], [
+    save_CXXFLAGS="$CXXFLAGS"
+    AC_MSG_CHECKING([whether to use C++ warning options ${CXX_WARNINGS}])
+    AC_LANG_PUSH(C++)
+    CXXFLAGS="$CXXFLAGS ${CXX_WARNINGS}"
+    AC_LANG_WERROR
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], [myac_cxx_warning_flags=yes],
+                      [myac_cxx_warning_flags=no])
+    AC_LANG_POP()
+    AC_MSG_RESULT([$myac_cxx_warning_flags])
+    CXXFLAGS="$save_CXXFLAGS"
+  ])
+
+  # Set compile flag variables.
+  AS_IF([test "$myac_c_warning_flags" = "yes"], [
+    AM_CFLAGS="${AM_CFLAGS} ${C_WARNINGS}"
+    AC_SUBST([AM_CFLAGS])])
+  AS_IF([test "$myac_cxx_warning_flags" = "yes"], [
+    AM_CXXFLAGS="${AM_CXXFLAGS} ${CXX_WARNINGS}"
+    AC_SUBST([AM_CXXFLAGS])])
+])
+
+
+# Set compiler flags required under maintainer mode.
+AC_DEFUN([MY_MAINTAINER_MODE_SETUP], [
+  AS_IF([test "$USE_MYSQL_MAINTAINER_MODE" = "yes"],
+        [MY_MAINTAINER_MODE_WARNINGS])
+])

=== modified file 'configure.in'
--- a/configure.in	2010-07-07 15:04:14 +0000
+++ b/configure.in	2010-07-09 01:05:56 +0000
@@ -65,6 +65,7 @@ MYSQL_TCP_PORT_DEFAULT=3306
 MYSQL_UNIX_ADDR_DEFAULT="/tmp/mysql.sock"
 
 dnl Include m4 
+sinclude(config/ac-macros/maintainer.m4)
 sinclude(config/ac-macros/alloca.m4)
 sinclude(config/ac-macros/check_cpu.m4)
 sinclude(config/ac-macros/character_sets.m4)
@@ -102,6 +103,8 @@ AC_SUBST(SHARED_LIB_MAJOR_VERSION)
 AC_SUBST(SHARED_LIB_VERSION)
 AC_SUBST(AVAILABLE_LANGUAGES)
 
+# Whether the maintainer mode should be enabled.
+MY_MAINTAINER_MODE
 
 # Canonicalize the configuration name.
 
@@ -2855,6 +2858,12 @@ do
 done
 AC_SUBST(sql_union_dirs)
 
+#
+# Setup maintainer mode options by the end to not disturb
+# system and other checks.
+#
+MY_MAINTAINER_MODE_SETUP
+
 # Some usefull subst
 AC_SUBST(CC)
 AC_SUBST(GXX)


Attachment: [text/bzr-bundle] bzr/davi.arnaut@sun.com-20100709010556-p1l3fn05by316qnz.bundle
Thread
bzr commit into mysql-5.1-bugteam branch (davi:3470) Bug#53445Davi Arnaut9 Jul