[epiphany/mcatanzaro/cflags: 8/9] Build with -Wextra and -Werror=format-security



commit b026c5af8c0eabb9173d847c2c52691d5043e09b
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat May 4 11:00:00 2019 -0500

    Build with -Wextra and -Werror=format-security
    
    We'll need to suppress a few warnings, and fix some code that triggers
    -Wsign-compare.
    
    One -Wsign-compare is not fixed here because it's a real bug, to be
    addressed separately.
    
    We'll also manually add -Werror=format-security since this is amazingly
    not included in -Wextra.

 lib/contrib/gvdb/README.epiphany  | 1 +
 lib/contrib/gvdb/gvdb-reader.c    | 2 +-
 lib/widgets/ephy-location-entry.c | 2 +-
 meson.build                       | 9 ++++++++-
 tests/ephy-web-app-utils-test.c   | 2 +-
 5 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/lib/contrib/gvdb/README.epiphany b/lib/contrib/gvdb/README.epiphany
index ac435617a..4347db97c 100644
--- a/lib/contrib/gvdb/README.epiphany
+++ b/lib/contrib/gvdb/README.epiphany
@@ -2,3 +2,4 @@ GVariant Database
 
  * Copied from https://git.gnome.org/browse/gvdb
  * Removed G_GNUC_INTERNAL
+ * Fixed -Wsign-compare
diff --git a/lib/contrib/gvdb/gvdb-reader.c b/lib/contrib/gvdb/gvdb-reader.c
index 8ccfc8f5f..47e23a882 100644
--- a/lib/contrib/gvdb/gvdb-reader.c
+++ b/lib/contrib/gvdb/gvdb-reader.c
@@ -418,7 +418,7 @@ gvdb_table_get_names (GvdbTable *table,
                 }
             }
 
-          else if (parent < n_names && names[parent] != NULL)
+          else if (parent < (guint32)n_names && names[parent] != NULL)
             {
               /* It's a non-root item whose parent was filled in already.
                *
diff --git a/lib/widgets/ephy-location-entry.c b/lib/widgets/ephy-location-entry.c
index d412af619..93f5552c1 100644
--- a/lib/widgets/ephy-location-entry.c
+++ b/lib/widgets/ephy-location-entry.c
@@ -725,7 +725,7 @@ button_box_size_allocated_cb (GtkWidget    *widget,
   GtkStateFlags state_flags;
   GtkBorder padding;
 
-  if (lentry->allocation_width == allocation->width)
+  if (lentry->allocation_width == (guint)allocation->width)
     return;
 
   lentry->allocation_width = allocation->width;
diff --git a/meson.build b/meson.build
index 9fba53214..251a5fe57 100644
--- a/meson.build
+++ b/meson.build
@@ -2,9 +2,16 @@ project('epiphany', 'c',
   license: 'GPL3+',
   version: '3.33.1',
   meson_version: '>= 0.46.0',
-  default_options: ['c_std=gnu11']
+  default_options: ['c_std=gnu11',
+                    'warning_level=2']
 )
 
+add_project_arguments('-Werror=format-security',
+                      '-Wno-cast-function-type',
+                      '-Wno-missing-field-initializers',
+                      '-Wno-unused-parameter',
+                      language: 'c')
+
 gnome = import('gnome')
 i18n = import('i18n')
 
diff --git a/tests/ephy-web-app-utils-test.c b/tests/ephy-web-app-utils-test.c
index 6e45c358c..8b1a918d8 100644
--- a/tests/ephy-web-app-utils-test.c
+++ b/tests/ephy-web-app-utils-test.c
@@ -49,7 +49,7 @@ static const WebAppTest test_web_app[] = {
 static void
 test_web_app_lifetime (void)
 {
-  int i;
+  guint i;
 
   for (i = 0; i < G_N_ELEMENTS (test_web_app); i++) {
     WebAppTest test = test_web_app[i];


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