[dia] build: enable some (somewhat) stricter warnings



commit 169edd6da4cde8a54732144eb7329fa11cd8a29b
Author: Zander Brown <zbrown gnome org>
Date:   Sun Nov 24 22:59:18 2019 +0000

    build: enable some (somewhat) stricter warnings
    
    Build is now quite noisy. this can be cleaned up over time and some warnings may become errors

 app/layer-editor/dia-layer-editor-dialog.c |  2 +-
 meson.build                                | 35 +++++++++++++++
 objects/UML/umlformalparameter.c           |  2 +-
 plug-ins/xfig/xfig-export.c                | 70 +++++++++++++++++++++---------
 4 files changed, 86 insertions(+), 23 deletions(-)
---
diff --git a/app/layer-editor/dia-layer-editor-dialog.c b/app/layer-editor/dia-layer-editor-dialog.c
index 70f552c9..b5f9f1cb 100644
--- a/app/layer-editor/dia-layer-editor-dialog.c
+++ b/app/layer-editor/dia-layer-editor-dialog.c
@@ -306,7 +306,7 @@ dia_layer_editor_dialog_new (void)
 }
 
 
-gboolean
+static gboolean
 find_diagram (GtkTreeModel *model,
               GtkTreePath  *path,
               GtkTreeIter  *iter,
diff --git a/meson.build b/meson.build
index db6f58d3..4fd5fc23 100644
--- a/meson.build
+++ b/meson.build
@@ -77,6 +77,41 @@ add_project_arguments([
   '-DGSEAL_ENABLE',
 ], language: 'c')
 
+
+global_c_args = []
+test_c_args = [
+  '-Wdeclaration-after-statement',
+  ['-Werror=format-security', '-Werror=format=2'],
+  '-Werror=missing-declarations',
+  '-Wformat-nonliteral',
+  '-Wformat-security',
+  '-Winit-self',
+  '-Wmaybe-uninitialized',
+  '-Wno-strict-aliasing',
+  '-Wno-unused-parameter',
+  '-Wold-style-definition',
+  '-Wshadow',
+  # When gtk3
+  # '-Wstrict-prototypes',
+  '-Wswitch-default',
+  '-Wswitch-enum',
+  '-Wunused-function',
+]
+if get_option('buildtype') != 'plain'
+  test_c_args += '-fstack-protector-strong'
+endif
+
+foreach arg: test_c_args
+  if cc.has_multi_arguments(arg)
+    global_c_args += arg
+  endif
+endforeach
+add_project_arguments(
+  global_c_args,
+  language: 'c'
+)
+
+
 subdir('po')
 subdir('lib')
 subdir('objects')
diff --git a/objects/UML/umlformalparameter.c b/objects/UML/umlformalparameter.c
index 90f9d7e1..837f8139 100644
--- a/objects/UML/umlformalparameter.c
+++ b/objects/UML/umlformalparameter.c
@@ -88,7 +88,7 @@ uml_formal_parameter_ref (UMLFormalParameter *param)
 }
 
 
-void
+static void
 formal_parameter_destroy (UMLFormalParameter *param)
 {
   g_free (param->name);
diff --git a/plug-ins/xfig/xfig-export.c b/plug-ins/xfig/xfig-export.c
index 36098c0c..ca9abce6 100644
--- a/plug-ins/xfig/xfig-export.c
+++ b/plug-ins/xfig/xfig-export.c
@@ -354,6 +354,7 @@ figLineStyle(XfigRenderer *renderer)
     return 4;
   case LINESTYLE_DOTTED:
     return 2;
+  case LINESTYLE_DEFAULT:
   default:
     return 0;
   }
@@ -515,27 +516,54 @@ figArrow(XfigRenderer *renderer, Arrow *arrow, real line_width)
   gchar al_buf[DTOSTR_BUF_SIZE];
 
   switch (arrow->type) {
-  case ARROW_NONE:
-    return;
-  case ARROW_LINES:             /* {open arrow} */
-    type = 0; style = 0; break;
-  case ARROW_UNFILLED_TRIANGLE:
-  case ARROW_HOLLOW_TRIANGLE:   /* {blanked arrow} */
-    type = 1; style = 0; break;
-  case ARROW_FILLED_TRIANGLE:   /* {filled arrow} */
-    type = 1; style = 1; break;
-  case ARROW_HOLLOW_DIAMOND:
-    type = 3; style = 0; break;
-  case ARROW_FILLED_DIAMOND:
-    type = 3; style = 1; break;
-  default:
-    message_warning(_("Fig format has no equivalent of arrow style %s; using simple arrow.\n"),
-                   arrow_get_name_from_type(arrow->type));
-    /* Notice fallthrough */
-  case ARROW_FILLED_CONCAVE:
-    type = 2; style = 1; break;
-  case ARROW_BLANKED_CONCAVE:
-    type = 2; style = 0; break;
+    case ARROW_NONE:
+      return;
+    case ARROW_LINES:             /* {open arrow} */
+      type = 0; style = 0; break;
+    case ARROW_UNFILLED_TRIANGLE:
+    case ARROW_HOLLOW_TRIANGLE:   /* {blanked arrow} */
+      type = 1; style = 0; break;
+    case ARROW_FILLED_TRIANGLE:   /* {filled arrow} */
+      type = 1; style = 1; break;
+    case ARROW_HOLLOW_DIAMOND:
+      type = 3; style = 0; break;
+    case ARROW_FILLED_DIAMOND:
+      type = 3; style = 1; break;
+    case ARROW_HALF_HEAD:
+    case ARROW_SLASHED_CROSS:
+    case ARROW_FILLED_ELLIPSE:
+    case ARROW_HOLLOW_ELLIPSE:
+    case ARROW_DOUBLE_HOLLOW_TRIANGLE:
+    case ARROW_DOUBLE_FILLED_TRIANGLE:
+    case ARROW_FILLED_DOT:
+    case ARROW_DIMENSION_ORIGIN:
+    case ARROW_BLANKED_DOT:
+    case ARROW_FILLED_BOX:
+    case ARROW_BLANKED_BOX:
+    case ARROW_SLASH_ARROW:
+    case ARROW_INTEGRAL_SYMBOL:
+    case ARROW_CROW_FOOT:
+    case ARROW_CROSS:
+    case ARROW_ROUNDED:
+    case ARROW_HALF_DIAMOND:
+    case ARROW_OPEN_ROUNDED:
+    case ARROW_FILLED_DOT_N_TRIANGLE:
+    case ARROW_ONE_OR_MANY:
+    case ARROW_NONE_OR_MANY:
+    case ARROW_ONE_OR_NONE:
+    case ARROW_ONE_EXACTLY:
+    case ARROW_BACKSLASH:
+    case ARROW_THREE_DOTS:
+    default:
+      message_warning(_("Fig format has no equivalent of arrow style %s; using simple arrow.\n"),
+          arrow_get_name_from_type(arrow->type));
+      /* Notice fallthrough */
+    case ARROW_FILLED_CONCAVE:
+      type = 2; style = 1; break;
+    case ARROW_BLANKED_CONCAVE:
+      type = 2; style = 0; break;
+    case MAX_ARROW_TYPE:
+      g_return_if_reached ();
   }
   fprintf(renderer->file, "  %d %d %s %s %s\n",
          type, style,


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