[glib/wip/pwithnall/network-address-test-fixes: 1/4] gdebugcontrollerdbus: Mark a variable as G_GNUC_UNUSED




commit cd9ed612a79161ca8427bbe1bfcb0d5adfb43106
Author: Philip Withnall <pwithnall endlessos org>
Date:   Tue Feb 22 09:25:56 2022 +0000

    gdebugcontrollerdbus: Mark a variable as G_GNUC_UNUSED
    
    It’s not used when compiling with `G_DISABLE_ASSERT`. This fixes the CI
    build failure here: https://gitlab.gnome.org/GNOME/glib/-/jobs/1843082
    ```
    [461/1229] Compiling C object 'gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o'.
    FAILED: gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o
    cc -Igio/6ae6c9e@@gio-2.0@sha -Igio -I../gio -I. -I../ -Iglib -I../glib -Igobject -I../gobject -Igmodule 
-I../gmodule -I/usr/include/libmount -I/usr/include/blkid -fdiagnostics-color=always -pipe 
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Wpedantic -Werror -std=gnu99 -g -D_GNU_SOURCE 
-fno-strict-aliasing -DG_ENABLE_DEBUG -DG_DISABLE_ASSERT -Wduplicated-branches -Wimplicit-fallthrough 
-Wmisleading-indentation -Wunused -Wno-unused-parameter -Wno-cast-function-type -Wno-pedantic 
-Wno-format-zero-length -Wno-variadic-macros -Werror=format=2 -Werror=init-self -Werror=missing-include-dirs 
-Werror=pointer-arith -Wstrict-prototypes -Wno-bad-function-cast -Werror=declaration-after-statement 
-Werror=implicit-function-declaration -Werror=missing-prototypes -fPIC '-DG_LOG_DOMAIN="GLib-GIO"' 
-DGIO_COMPILATION '-DGIO_MODULE_DIR="/usr/local/lib64/gio/modules"' '-DLOCALSTATEDIR="/usr/local/var"' 
-fvisibility=hidden -MD -MQ 'gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o' -MF 'gio/6ae
 6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o.d' -o 'gio/6ae6c9e@@gio-2.0@sha/gdebugcontrollerdbus.c.o' -c 
../gio/gdebugcontrollerdbus.c
    ../gio/gdebugcontrollerdbus.c: In function ‘authorize_cb’:
    ../gio/gdebugcontrollerdbus.c:345:32: error: unused variable ‘priv’ [-Werror=unused-variable]
      345 |   GDebugControllerDBusPrivate *priv = g_debug_controller_dbus_get_instance_private (self);
          |                                ^~~~
    cc1: all warnings being treated as errors
    ```
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>

 gio/gdebugcontrollerdbus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gio/gdebugcontrollerdbus.c b/gio/gdebugcontrollerdbus.c
index e989a6298..3c0ee007e 100644
--- a/gio/gdebugcontrollerdbus.c
+++ b/gio/gdebugcontrollerdbus.c
@@ -342,13 +342,14 @@ authorize_cb (GObject      *object,
               gpointer      user_data)
 {
   GDebugControllerDBus *self = G_DEBUG_CONTROLLER_DBUS (object);
-  GDebugControllerDBusPrivate *priv = g_debug_controller_dbus_get_instance_private (self);
+  GDebugControllerDBusPrivate *priv G_GNUC_UNUSED  /* when compiling with G_DISABLE_ASSERT */;
   GTask *task = G_TASK (result);
   GDBusMethodInvocation *invocation = g_task_get_task_data (task);
   GVariant *parameters = g_dbus_method_invocation_get_parameters (invocation);
   gboolean enabled = FALSE;
   gboolean authorized;
 
+  priv = g_debug_controller_dbus_get_instance_private (self);
   authorized = g_task_propagate_boolean (task, NULL);
 
   if (!authorized)


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