[glib: 1/2] gtask: Use unsigned bit-field struct values to avoid warnings




commit 4398d140c7ca721d710e35f7a2725b5f8375fd90
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Oct 18 21:23:56 2022 +0200

    gtask: Use unsigned bit-field struct values to avoid warnings
    
    In recent Clang we may get a build warning as per:
    
      ../gio/gtask.c: warning: implicit truncation from 'int' to a
        one-bit wide bit-field changes value from 1 to -1
        [-Wsingle-bit-bitfield-constant-conversion]
    
    This is because we use gboolean (and thus a signed type) for bit-fields.
    Now, this is not an issue in practice for the way we're using them, but
    still better to mute such compiler warns in the right way.

 gio/gtask.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gio/gtask.c b/gio/gtask.c
index e8c2ef2820..5e2a20d648 100644
--- a/gio/gtask.c
+++ b/gio/gtask.c
@@ -573,21 +573,21 @@ struct _GTask {
   gboolean thread_cancelled;
 
   /* Protected by the lock when task is threaded: */
-  gboolean thread_complete : 1;
-  gboolean return_on_cancel : 1;
-  gboolean : 0;
+  guint thread_complete : 1;
+  guint return_on_cancel : 1;
+  guint : 0;
 
   /* Unprotected, but written to when task runs in thread: */
-  gboolean completed : 1;
-  gboolean had_error : 1;
-  gboolean result_set : 1;
-  gboolean ever_returned : 1;
-  gboolean : 0;
+  guint completed : 1;
+  guint had_error : 1;
+  guint result_set : 1;
+  guint ever_returned : 1;
+  guint : 0;
 
   /* Read-only once task runs in thread: */
-  gboolean check_cancellable : 1;
-  gboolean synchronous : 1;
-  gboolean blocking_other_task : 1;
+  guint check_cancellable : 1;
+  guint synchronous : 1;
+  guint blocking_other_task : 1;
 
   GError *error;
   union {


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