[glib: 12/13] gobject: Fix various compiler warnings when compiling with G_DISABLE_ASSERT



commit 3d3ca9f1febc24e1d974bf4b895ade5513492b5f
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Mar 5 12:24:01 2019 +0000

    gobject: Fix various compiler warnings when compiling with G_DISABLE_ASSERT
    
    Mostly unused variables which are only used in a g_assert() call
    otherwise.
    
    Signed-off-by: Philip Withnall <withnall endlessm com>
    
    Helps: #1708

 gobject/gboxed.c      | 2 +-
 gobject/genums.c      | 2 +-
 gobject/gobject.c     | 2 +-
 gobject/gparamspecs.c | 7 ++++++-
 gobject/gtype.c       | 2 +-
 gobject/gvaluetypes.c | 2 +-
 6 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/gobject/gboxed.c b/gobject/gboxed.c
index cc7166456..e4ebebeeb 100644
--- a/gobject/gboxed.c
+++ b/gobject/gboxed.c
@@ -100,7 +100,7 @@ _g_boxed_type_init (void)
     NULL,                       /* value_table */
   };
   const GTypeFundamentalInfo finfo = { G_TYPE_FLAG_DERIVABLE, };
-  GType type;
+  GType type G_GNUC_UNUSED  /* when compiling with G_DISABLE_ASSERT */;
 
   /* G_TYPE_BOXED
    */
diff --git a/gobject/genums.c b/gobject/genums.c
index aa27c6bb4..f78370053 100644
--- a/gobject/genums.c
+++ b/gobject/genums.c
@@ -113,7 +113,7 @@ _g_enum_types_init (void)
   static const GTypeFundamentalInfo finfo = {
     G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_DERIVABLE,
   };
-  GType type;
+  GType type G_GNUC_UNUSED  /* when compiling with G_DISABLE_ASSERT */;
   
   g_return_if_fail (initialized == FALSE);
   initialized = TRUE;
diff --git a/gobject/gobject.c b/gobject/gobject.c
index 3095743c5..d709a1938 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -381,7 +381,7 @@ _g_object_type_init (void)
     "p",                         /* lcopy_format */
     g_value_object_lcopy_value,          /* lcopy_value */
   };
-  GType type;
+  GType type G_GNUC_UNUSED  /* when compiling with G_DISABLE_ASSERT */;
   
   g_return_if_fail (initialized == FALSE);
   initialized = TRUE;
diff --git a/gobject/gparamspecs.c b/gobject/gparamspecs.c
index d76e12f55..5d15c26e1 100644
--- a/gobject/gparamspecs.c
+++ b/gobject/gparamspecs.c
@@ -1191,11 +1191,16 @@ void
 _g_param_spec_types_init (void)        
 {
   const guint n_types = 23;
-  GType type, *spec_types, *spec_types_bound;
+  GType type, *spec_types;
+#ifndef G_DISABLE_ASSERT
+  GType *spec_types_bound;
+#endif
 
   g_param_spec_types = g_new0 (GType, n_types);
   spec_types = g_param_spec_types;
+#ifndef G_DISABLE_ASSERT
   spec_types_bound = g_param_spec_types + n_types;
+#endif
   
   /* G_TYPE_PARAM_CHAR
    */
diff --git a/gobject/gtype.c b/gobject/gtype.c
index 1acc0a075..8a60105e8 100644
--- a/gobject/gtype.c
+++ b/gobject/gtype.c
@@ -4362,7 +4362,7 @@ gobject_init (void)
   const gchar *env_string;
   GTypeInfo info;
   TypeNode *node;
-  GType type;
+  GType type G_GNUC_UNUSED  /* when compiling with G_DISABLE_ASSERT */;
 
   /* Ensure GLib is initialized first, see
    * https://bugzilla.gnome.org/show_bug.cgi?id=756139
diff --git a/gobject/gvaluetypes.c b/gobject/gvaluetypes.c
index 17d1a70a9..35b85c684 100644
--- a/gobject/gvaluetypes.c
+++ b/gobject/gvaluetypes.c
@@ -435,7 +435,7 @@ _g_value_types_init (void)
     NULL,                      /* value_table */
   };
   const GTypeFundamentalInfo finfo = { G_TYPE_FLAG_DERIVABLE, };
-  GType type;
+  GType type G_GNUC_UNUSED  /* when compiling with G_DISABLE_ASSERT */;
   
   /* G_TYPE_CHAR / G_TYPE_UCHAR
    */


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