From 22906ff398780f6acd9965a21d9eb52abf854fdb Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Sat, 20 Jan 2024 04:51:39 +0300 Subject: fixed Clang warnings about one-bit-wide boolean integers (-Wsingle-bit-bitfield-constant-conversion) * gboolean is defined as gint which is a signed type. A gboolean 1-bit-wide bitfield cannot have the values 0 and 1 but only 0 and -1. * This wasn't practically a bug unless you would try to compare one of those bitfields with TRUE. * All of those bitfields are now guint, even though this is less self-documenting. --- src/parser.h | 12 ++++++------ src/qreg.c | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/parser.h b/src/parser.h index 05a9715..8858132 100644 --- a/src/parser.h +++ b/src/parser.h @@ -46,7 +46,7 @@ typedef struct { * a signed integer, it's ok steal one * bit for the pass_through flag. */ - gboolean pass_through : 1; + guint pass_through : 1; } teco_loop_context_t; extern GArray *teco_loop_stack; @@ -71,8 +71,8 @@ void undo__remove_index__teco_loop_stack(guint); * FIXME: Maybe use TECO_DECLARE_VTABLE_METHOD()? */ typedef const struct { - gboolean string_building : 1; - gboolean last : 1; + guint string_building : 1; + guint last : 1; /** * Called repeatedly to process chunks of input and give interactive feedback. @@ -185,7 +185,7 @@ struct teco_state_t { * This is separate of TECO_FNMACRO_MASK_START which is set * only in the main machine's start states. */ - gboolean is_start : 1; + guint is_start : 1; /** * Function key macro mask. * This is not a bitmask since it is compared with values set @@ -435,8 +435,8 @@ struct teco_machine_main_t { struct { teco_mode_t mode : 8; - gboolean modifier_colon : 1; - gboolean modifier_at : 1; + guint modifier_colon : 1; + guint modifier_at : 1; }; guint __flags; }; diff --git a/src/qreg.c b/src/qreg.c index 40e1c2e..8057909 100644 --- a/src/qreg.c +++ b/src/qreg.c @@ -1145,7 +1145,7 @@ struct teco_machine_qregspec_t { union { struct { teco_qreg_type_t type : 8; - gboolean parse_only : 1; + guint parse_only : 1; }; guint __flags; }; -- cgit v1.2.3