Compile with gcc warnings by default
authorDan Winship <danw@gnome.org>
Wed, 1 Dec 2010 00:49:59 +0000 (19:49 -0500)
committerDan Winship <danw@gnome.org>
Wed, 1 Dec 2010 01:47:32 +0000 (20:47 -0500)
configure.ac
tls/gnutls/gtlsconnection-gnutls.c

index 17a94fb..2617595 100644 (file)
@@ -110,6 +110,35 @@ if test "x$with_gnutls" = "xyes"; then
     fi
 fi
 
+dnl *************************************
+dnl *** Warnings to show if using GCC ***
+dnl *************************************
+
+AC_ARG_ENABLE(more-warnings,
+             AS_HELP_STRING([--disable-more-warnings], [Inhibit compiler warnings]),
+             set_more_warnings=no)
+
+if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
+       CFLAGS="$CFLAGS \
+               -Wall -Wstrict-prototypes -Wmissing-declarations \
+               -Wmissing-prototypes -Wnested-externs -Wpointer-arith \
+               -Wdeclaration-after-statement -Wformat=2 -Winit-self \
+               -Waggregate-return -Wmissing-format-attribute"
+
+       for option in -Wmissing-include-dirs -Wundef; do
+               SAVE_CFLAGS="$CFLAGS"
+               CFLAGS="$CFLAGS $option"
+               AC_MSG_CHECKING([whether gcc understands $option])
+               AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])],
+                                 [has_option=yes],
+                                 [has_option=no])
+               AC_MSG_RESULT($has_option)
+               if test $has_option = no; then
+                       CFLAGS="$SAVE_CFLAGS"
+               fi
+       done
+fi
+
 dnl *****************************
 dnl *** done                  ***
 dnl *****************************
index 2c28050..b2b166d 100644 (file)
@@ -290,7 +290,6 @@ g_tls_connection_gnutls_set_property (GObject      *object,
                                      GParamSpec   *pspec)
 {
   GTlsConnectionGnutls *gnutls = G_TLS_CONNECTION_GNUTLS (object);
-  GList *list, *copy, *c;
   GInputStream *istream;
   GOutputStream *ostream;
 
@@ -428,7 +427,7 @@ g_tls_connection_gnutls_validate_peer (GTlsConnectionGnutls *gnutls)
   return gtls_errors;
 }
 
-void
+static void
 begin_gnutls_io (GTlsConnectionGnutls  *gnutls,
                 gboolean               blocking,
                 GCancellable          *cancellable)
@@ -439,7 +438,7 @@ begin_gnutls_io (GTlsConnectionGnutls  *gnutls,
   g_clear_error (&gnutls->priv->error);
 }
 
-int
+static int
 end_gnutls_io (GTlsConnectionGnutls  *gnutls,
               int                    status,
               const char            *generic_error,