[glib-networking/mcatanzaro/limited-werror] Add very limited usage of Werror



commit 642b380c78cc6bbe6867eb41c748717f758c4e78
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Sep 20 13:36:22 2019 -0500

    Add very limited usage of Werror
    
    We should never allow implicit-function-declaration errors.
    
    Also, although the advisibility of putting all declarations at the top
    of functions is highly questionable, it's our existing code style, very
    common in GNOME, and it's useful to enforce this.

 meson.build                    | 4 ++++
 tls/base/gtlsconnection-base.c | 2 +-
 tls/tests/connection.c         | 6 +++---
 3 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/meson.build b/meson.build
index 7d3e3c7..d07d7fa 100644
--- a/meson.build
+++ b/meson.build
@@ -33,6 +33,10 @@ common_flags = [
 
 add_project_arguments(common_flags, language: 'c')
 
+cflags = cc.get_supported_arguments(['-Werror=declaration-after-statement',
+                                     '-Werror=implicit-function-declaration'])
+add_project_arguments(cflags, language: 'c')
+
 symbol_map = join_paths(meson.current_source_dir(), meson.project_name() + '.map')
 
 module_ldflags = []
diff --git a/tls/base/gtlsconnection-base.c b/tls/base/gtlsconnection-base.c
index 76efab1..e80177e 100644
--- a/tls/base/gtlsconnection-base.c
+++ b/tls/base/gtlsconnection-base.c
@@ -2593,11 +2593,11 @@ GTLS_DEBUG (gpointer    connection,
             ...)
 {
   char *result = NULL;
+  va_list args;
   int ret;
 
   g_assert (G_IS_TLS_CONNECTION (connection));
 
-  va_list args;
   va_start (args, message);
 
   ret = g_vasprintf (&result, message, args);
diff --git a/tls/tests/connection.c b/tls/tests/connection.c
index ff7e8cb..680f48c 100644
--- a/tls/tests/connection.c
+++ b/tls/tests/connection.c
@@ -2252,14 +2252,14 @@ test_alpn (TestConnection *test,
            const char * const *server_protocols,
            const char *negotiated_protocol)
 {
+  GIOStream *connection;
+  GError *error = NULL;
+
 #ifdef BACKEND_IS_OPENSSL
   g_test_skip ("this is not yet passing with openssl");
   return;
 #endif
 
-  GIOStream *connection;
-  GError *error = NULL;
-
   test->server_protocols = server_protocols;
 
   test->database = g_tls_file_database_new (tls_test_file_path ("ca-roots.pem"), &error);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]