From 051b463c9a4d3724cb93b7aa1e84b48a1d40e399 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 27 Apr 2023 06:46:36 +0200 Subject: [PATCH] Fix various bitfield warnings clang rightly complains about using gboolean as type for bitfields, since it is signed. Avoid that. --- gsk/gl/gskglcommandqueue.c | 8 ++++---- gsk/gl/gskglprofiler.c | 6 +++--- gsk/gskprofiler.c | 8 ++++---- gsk/gskrenderer.c | 2 +- gtk/gtkbuilderprivate.h | 6 +++--- gtk/gtkfilesystemmodel.c | 19 +++++++++---------- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index d5aa01a5f8..d286c001ba 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -1020,10 +1020,10 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self, guint program = 0; guint width = 0; guint height = 0; - G_GNUC_UNUSED guint n_binds = 0; - guint n_fbos = 0; - G_GNUC_UNUSED guint n_uniforms = 0; - guint n_programs = 0; + G_GNUC_UNUSED unsigned int n_binds = 0; + G_GNUC_UNUSED unsigned int n_fbos = 0; + G_GNUC_UNUSED unsigned int n_uniforms = 0; + G_GNUC_UNUSED unsigned int n_programs = 0; guint vao_id; guint vbo_id; int textures[4]; diff --git a/gsk/gl/gskglprofiler.c b/gsk/gl/gskglprofiler.c index 2721641858..6aff5ab0a5 100644 --- a/gsk/gl/gskglprofiler.c +++ b/gsk/gl/gskglprofiler.c @@ -18,9 +18,9 @@ struct _GskGLProfiler GLuint gl_queries[N_QUERIES]; GLuint active_query; - gboolean has_queries : 1; - gboolean has_timer : 1; - gboolean first_frame : 1; + unsigned int has_queries : 1; + unsigned int has_timer : 1; + unsigned int first_frame : 1; }; enum { diff --git a/gsk/gskprofiler.c b/gsk/gskprofiler.c index a34844eb70..3f35646a33 100644 --- a/gsk/gskprofiler.c +++ b/gsk/gskprofiler.c @@ -9,7 +9,7 @@ typedef struct { char *description; gint64 value; gint64 n_samples; - gboolean can_reset : 1; + unsigned int can_reset : 1; } NamedCounter; typedef struct { @@ -21,9 +21,9 @@ typedef struct { gint64 max_value; gint64 avg_value; gint64 n_samples; - gboolean in_flight : 1; - gboolean can_reset : 1; - gboolean invert : 1; + unsigned int in_flight : 1; + unsigned int can_reset : 1; + unsigned int invert : 1; } NamedTimer; typedef struct { diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c index eeb6408506..5bd214e026 100644 --- a/gsk/gskrenderer.c +++ b/gsk/gskrenderer.c @@ -83,7 +83,7 @@ typedef struct GskDebugFlags debug_flags; - gboolean is_realized : 1; + unsigned int is_realized : 1; } GskRendererPrivate; G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GskRenderer, gsk_renderer, G_TYPE_OBJECT) diff --git a/gtk/gtkbuilderprivate.h b/gtk/gtkbuilderprivate.h index 218e33628a..8e9708ba8e 100644 --- a/gtk/gtkbuilderprivate.h +++ b/gtk/gtkbuilderprivate.h @@ -69,9 +69,9 @@ typedef struct { GParamSpec *pspec; gpointer value; GString *text; - gboolean translatable : 1; - gboolean bound : 1; - gboolean applied : 1; + unsigned int translatable : 1; + unsigned int bound : 1; + unsigned int applied : 1; char *context; int line; int col; diff --git a/gtk/gtkfilesystemmodel.c b/gtk/gtkfilesystemmodel.c index 47129f10d3..a772d67aa6 100644 --- a/gtk/gtkfilesystemmodel.c +++ b/gtk/gtkfilesystemmodel.c @@ -66,22 +66,21 @@ struct _GtkFileSystemModel GArray * files; /* array of FileModelNode containing all our files */ guint n_nodes_valid; /* count of valid nodes (i.e. those whose node->row is accurate) */ GHashTable * file_lookup; /* mapping of GFile => array index in model->files - * This hash table doesn't always have the same number of entries as the files array; - * The hash table gets re-populated in node_get_for_file() if this mismatch is - * detected. + * This hash table doesn't always have the same number of entries + * as the files array; it gets re-populated in node_get_for_file() + * if this mismatch is detected. */ GtkFileFilter * filter; /* filter to use for deciding which nodes are visible */ guint frozen; /* number of times we're frozen */ - gboolean filter_on_thaw :1;/* set when filtering needs to happen upon thawing */ - - guint show_hidden :1; /* whether to show hidden files */ - guint show_folders :1;/* whether to show folders */ - guint show_files :1; /* whether to show files */ - guint filter_folders :1;/* whether filter applies to folders */ - guint can_select_files : 1; + unsigned int filter_on_thaw : 1; /* set when filtering needs to happen upon thawing */ + unsigned int show_hidden : 1; /* whether to show hidden files */ + unsigned int show_folders : 1; /* whether to show folders */ + unsigned int show_files : 1; /* whether to show files */ + unsigned int filter_folders : 1; /* whether filter applies to folders */ + unsigned int can_select_files : 1; }; static void freeze_updates (GtkFileSystemModel *model);