List:Commits« Previous MessageNext Message »
From:Monty Taylor Date:July 16 2008 2:52pm
Subject:bzr commit into NDB/Bindings:trunk branch (monty:408)
View as plain text  
#At https://bazaar.launchpad.net/~ndb-bindings/ndb-bindings/trunk

  408 Monty Taylor	2008-07-16
      Re-worked warnings with configure-time switches.
modified:
  configure.ac

=== modified file 'configure.ac'
--- a/configure.ac	2008-07-15 23:29:11 +0000
+++ b/configure.ac	2008-07-16 14:51:37 +0000
@@ -39,27 +39,9 @@ AS_IF([test "x$SED" = "x"],
 
 GLOBAL_INCLUDES="-I\${top_srcdir} -I\${top_builddir} -I\$(top_srcdir)/mgmpp -I\$(top_srcdir)/ndbpp "
 
-# We put warnings and optimization flags in GLOBAL_CPPFLAGS, since we will
-# put them in per-dir AM_CPPFLAGS. They come before
-# CPPFLAGS in the build, so that User CPPFLAGS from the ENV will take effect
-# over these. We put includes (above) in CXXFLAGS since that comes after, and
-# we do _not_ want those to be overridden by ENV
-# -02 causes problems per SWIG... although I think we should get that fixed, 
-# but autoconf only defines it if GCC=yes, so it's easy to fix at this point
-if test "$GCC" = "yes"
-then
-  
-  CXXFLAGS="${GLOBAL_INCLUDES}"
-  CFLAGS="${GLOBAL_INCLUDES}"
+CXXFLAGS="${GLOBAL_INCLUDES}"
+CFLAGS="${GLOBAL_INCLUDES}"
 
-# We can't use these just yet...
-#  CWARNINGS="-W -Wall "
-#  CPPWARNINGS="-W -Wall "
-
-  GLOBAL_CFLAGS="-O0 -ggdb3 ${CWARNINGS} ${PTHREAD_CFLAGS}"
-  GLOBAL_CPPFLAGS="-O0 -ggdb3 ${CPPWARNINGS} ${PTHREAD_CFLAGS}"
-
-fi
 
 AC_PROG_SWIG(1.3.31)
 SWIG_ENABLE_CXX()
@@ -117,6 +99,87 @@ SWIG="$SWIG \${DEFS} -DDOXYGEN_SHOULD_SK
 GENERATED="# This file is autogenerated!" 
 AC_SUBST(GENERATED)
 
+AC_ARG_ENABLE([pedantic-warnings],
+    [AS_HELP_STRING([--enable-pedantic-warnings],
+       [Toggle pedanticness @<:@default=off@:>@])],
+    [ac_warn_pedantic="$enableval"],
+    [ac_warn_pedantic="no"])
+
+AC_ARG_ENABLE([fail],
+    [AS_HELP_STRING([--enable-fail],
+       [Turn warnings into failures @<:@default=off@:>@])],
+    [ac_warn_fail="$enableval"],
+    [ac_warn_fail="no"])
+
+AC_ARG_ENABLE([unreachable],
+    [AS_HELP_STRING([--enable-unreachable],
+       [Enable warnings about unreachable code @<:@default=off@:>@])],
+    [ac_warn_unreachable="$enableval"],
+    [ac_warn_unreachable="no"])
+
+AC_ARG_ENABLE([longlong-warnings],
+    [AS_HELP_STRING([--enable-longlong-warnings],
+       [Enable warnings about longlong in C++ @<:@default=off@:>@])],
+    [ac_warn_longlong="$enableval"],
+    [ac_warn_longlong="no"])
+
+AC_ARG_ENABLE([strict-aliasing],
+    [AS_HELP_STRING([--enable-strict-aliasing],
+       [Enable warnings about stict-aliasing @<:@default=off@:>@])],
+    [ac_warn_strict_aliasing="$enableval"],
+    [ac_warn_strict_aliasing="no"])
+
+
+# We put warnings and optimization flags in GLOBAL_CPPFLAGS, since we will
+# put them in per-dir AM_CPPFLAGS. They come before
+# CPPFLAGS in the build, so that User CPPFLAGS from the ENV will take effect
+# over these. We put includes (above) in CXXFLAGS since that comes after, and
+# we do _not_ want those to be overridden by ENV
+# -02 causes problems per SWIG... although I think we should get that fixed, 
+# but autoconf only defines it if GCC=yes, so it's easy to fix at this point
+if test "$GCC" = "yes"
+then
+  
+  if test "$ac_warn_longlong" = "yes"
+  then
+    W_LONGLONG="-Wlong-long"
+  else
+    W_LONGLONG="-Wno-long-long"
+  fi
+
+  if test "$ac_warn_strict_aliasing" = "yes"
+  then
+    W_STRICT_ALIASING="-Wstrict-aliasing"
+  else
+    W_STRICT_ALIASING="-Wno-strict-aliasing"
+  fi
+
+  if test "$ac_warn_pedantic" = "yes"
+  then
+    GCC_PEDANTIC="-pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls ${W_STRICT_ALIASING}"
+    GXX_PEDANTIC="-pedantic -Wundef -Wredundant-decls ${W_LONGLONG} ${W_STRICT_ALIASING}"
+  fi
+
+  if test "$ac_warn_unreachable" = "yes"
+  then
+    W_UNREACHABLE="-Wunreachable-code"
+  fi
+
+  if test "$ac_warn_fail" = "yes"
+  then
+    W_FAIL="-Werror"
+  fi
+
+  BASE_WARNINGS="-W -Wall -Wextra"
+  GCC_WARNINGS="${BASE_WARNINGS} -std=gnu99 ${GCC_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL}"
+  GXX_WARNINGS="${BASE_WARNINGS} -std=gnu++98 ${GXX_PEDANTIC} ${W_UNREACHABLE} ${W_FAIL}"
+
+
+  GLOBAL_CFLAGS="-O0 -ggdb3 ${GCC_WARNINGS} ${PTHREAD_CFLAGS}"
+  GLOBAL_CPPFLAGS="-O0 -ggdb3 ${GXX_WARNINGS} ${PTHREAD_CFLAGS}"
+
+fi
+
 AC_SUBST(GLOBAL_CPPFLAGS)
 AC_SUBST(GLOBAL_CFLAGS)
 

Thread
bzr commit into NDB/Bindings:trunk branch (monty:408) Monty Taylor16 Jul