[Ltrace-devel] [PATCH 3/6] Use more warnings by default and make them errors
Zachary T Welch
zwelch at codesourcery.com
Thu Dec 9 02:55:11 UTC 2010
Compiler warnings should not be limited to building with debugging,
so this patch enbles them for all builds. Since -Werror may cause
unforseen problems, it provides the --disable-werror option to allow
users to get around any possible problems that it may cause; however,
the proper solution will always be to fix the code to eliminate the
warning from occuring in the first place.
This patch also puts these flags in AM_CFLAGS, so they will not
be affected by the user providing their own CFLAGS settings.
Signed-off-by: Zachary T Welch <zwelch at codesourcery.com>
---
configure.ac | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/configure.ac b/configure.ac
index ab813ec..bd16d80 100644
--- a/configure.ac
+++ b/configure.ac
@@ -143,8 +143,6 @@ CPPFLAGS=" \
-I\$(top_srcdir) \
"
-CFLAGS="${CFLAGS} -Wall"
-
# Checks for header files.
AC_CHECK_HEADERS([ \
fcntl.h \
@@ -199,16 +197,22 @@ AC_ARG_ENABLE(debug,
[CONFIG_DEBUG=no])
AC_MSG_RESULT([${CONFIG_DEBUG}])
if test "${CONFIG_DEBUG}" = "yes"; then
- CFLAGS="${CFLAGS} -Werror -Wsign-compare -Wfloat-equal -Wformat-security -g -O1"
+ CFLAGS="${CFLAGS} -g -O1"
AC_DEFINE(DEBUG, 1, [debugging])
else
CFLAGS="${CFLAGS} -O2"
fi
-dnl testsuite/Makefile
-dnl testsuite/ltrace.main/Makefile
-dnl testsuite/ltrace.minor/Makefile
-dnl testsuite/ltrace.torture/Makefile
+# Ignore the compiler's warnings at your own risk.
+AM_CFLAGS="${AM_CFLAGS} -Wall -Wsign-compare -Wfloat-equal -Wformat-security"
+AC_ARG_ENABLE([werror],
+ AS_HELP_STRING([--disable-werror], [disable use of -Werror]),
+ [enable_werror=$enableval], [enable_werror=yes])
+if test x$enable_werror = xyes; then
+ AM_CFLAGS="${AM_CFLAGS} -Werror"
+fi
+
+AC_SUBST(AM_CFLAGS)
AC_CONFIG_FILES([
Makefile
--
1.7.2.2
More information about the Ltrace-devel
mailing list