summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rwxr-xr-xautogen.sh5
-rw-r--r--configure.ac59
-rw-r--r--src/ChangeLog5
-rw-r--r--src/g10lib.h11
5 files changed, 53 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index 13ce78aa..6690deda 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-30 Werner Koch <wk@g10code.com>
+
+ * configure.ac: Remove option --enable-gcc-warnings. Autodetect
+ useful gcc warnings in maintainer mode.
+
2008-09-18 Werner Koch <wk@g10code.com>
Release 1.4.3.
diff --git a/autogen.sh b/autogen.sh
index 6bc47c4e..3f2db4f7 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -195,5 +195,6 @@ $AUTOMAKE --gnu;
echo "Running autoconf${FORCE} ..."
$AUTOCONF${FORCE}
-echo "You may now run \"./configure --enable-maintainer-mode && make\"."
-echo "(gcc users may want to add the option \"--enable-gcc-warnings\")"
+echo "You may now run:
+ ./configure --enable-maintainer-mode && make
+"
diff --git a/configure.ac b/configure.ac
index de41ea5a..85ec5f7d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -852,39 +852,40 @@ AC_ARG_ENABLE(optimization,
CFLAGS=`echo $CFLAGS | sed 's/-O[[0-9]]//'`
fi])
-AC_ARG_ENABLE(gcc-warnings,
- AC_HELP_STRING([--enable-gcc-warnings],
- [enable more verbose gcc warnings]),
- [more_gcc_warnings="$enableval"],
- [more_gcc_warnings="no"])
-
+# CFLAGS mangling when using gcc.
if test "$GCC" = yes; then
- if test "$USE_MAINTAINER_MODE" = "yes" ||
- test "$more_gcc_warnings" = "yes"; then
- CFLAGS="$CFLAGS -Wall -Wcast-align -Wshadow -Wstrict-prototypes"
- if test "$more_gcc_warnings" = "yes"; then
- CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
- CFLAGS="$CFLAGS -Wwrite-strings"
- CFLAGS="$CFLAGS -Wdeclaration-after-statement"
- CFLAGS="$CFLAGS -Wno-missing-field-initializers"
- CFLAGS="$CFLAGS -Wno-sign-compare"
- # Note: We don't use -Wunreachable-code because this gives
- # warnings for all asserts and many inline functions like
- # gpg_error (gcc 4.1.2 20060928).
+ CFLAGS="$CFLAGS -Wall"
+ if test "$USE_MAINTAINER_MODE" = "yes"; then
+ CFLAGS="$CFLAGS -Wcast-align -Wshadow -Wstrict-prototypes"
+ CFLAGS="$CFLAGS -Wformat -Wno-format-y2k -Wformat-security"
+
+ # If -Wno-missing-field-initializers is supported we can enable a
+ # a bunch of really useful warnings.
+ AC_MSG_CHECKING([if gcc supports -Wno-missing-field-initializers])
+ _gcc_cflags_save=$CFLAGS
+ CFLAGS="-Wno-missing-field-initializers"
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
+ AC_MSG_RESULT($_gcc_wopt)
+ CFLAGS=$_gcc_cflags_save;
+ if test x"$_gcc_wopt" = xyes ; then
+ CFLAGS="$CFLAGS -W -Wextra -Wbad-function-cast"
+ CFLAGS="$CFLAGS -Wwrite-strings"
+ CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+ CFLAGS="$CFLAGS -Wno-missing-field-initializers"
+ CFLAGS="$CFLAGS -Wno-sign-compare"
fi
- else
- CFLAGS="$CFLAGS -Wall"
- fi
- AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
- _gcc_cflags_save=$CFLAGS
- CFLAGS="-Wpointer-arith"
- AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
- AC_MSG_RESULT($_gcc_wopt)
- CFLAGS=$_gcc_cflags_save;
- if test x"$_gcc_wopt" = xyes ; then
- CFLAGS="$CFLAGS -Wpointer-arith"
+ AC_MSG_CHECKING([if gcc supports -Wpointer-arith])
+ _gcc_cflags_save=$CFLAGS
+ CFLAGS="-Wpointer-arith"
+ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([]),_gcc_wopt=yes,_gcc_wopt=no)
+ AC_MSG_RESULT($_gcc_wopt)
+ CFLAGS=$_gcc_cflags_save;
+ if test x"$_gcc_wopt" = xyes ; then
+ CFLAGS="$CFLAGS -Wpointer-arith"
+ fi
fi
+
fi
# Check whether as(1) supports a noeexecstack feature. This test
diff --git a/src/ChangeLog b/src/ChangeLog
index ff50b49f..86fd72d3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-30 Werner Koch <wk@g10code.com>
+
+ * g10lib.h (GCC_ATTR_FORMAT_ARG): New.
+ (_gcry_gettext): Use it.
+
2008-10-24 Werner Koch <wk@g10code.com>
* global.c (inactive_fips_mode): Move to fips.c.
diff --git a/src/g10lib.h b/src/g10lib.h
index a3ffb127..22f9acff 100644
--- a/src/g10lib.h
+++ b/src/g10lib.h
@@ -58,6 +58,15 @@
#define GCC_ATTR_NORETURN
#endif
+#if __GNUC__ >= 3
+/* According to glibc this attribute is available since 2.8 however we
+ better play safe and use it only with gcc 3 or newer. */
+#define GCC_ATTR_FORMAT_ARG(a) __attribute__ ((format_arg (a)))
+#else
+#define GCC_ATTR_FORMAT_ARG(a)
+#endif
+
+
/* Gettext macros. */
#define _(a) _gcry_gettext(a)
@@ -92,7 +101,7 @@ void _gcry_bug (const char *file, int line);
void _gcry_assert_failed (const char *expr, const char *file, int line);
#endif
-const char *_gcry_gettext (const char *key);
+const char *_gcry_gettext (const char *key) GCC_ATTR_FORMAT_ARG(1);
void _gcry_fatal_error(int rc, const char *text ) JNLIB_GCC_A_NR;
void _gcry_log( int level, const char *fmt, ... ) JNLIB_GCC_A_PRINTF(2,3);
void _gcry_log_bug( const char *fmt, ... ) JNLIB_GCC_A_NR_PRINTF(1,2);