gobject: Cast various inverted bitfield constants to unsigned

This fixes `-Wsign-conversion` warnings, though I’m not sure why the
compiler is emitting them. The signed/unsigned status of flag enum
members is not particularly well defined in the C standard (and even
less well understood by me), so just do what seems necessary to shut the
compiler up.

The benefits of enabling `-Wsign-conversion` across the codebase
hopefully outweighs this noise.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3405
This commit is contained in:
Philip Withnall
2025-04-11 15:08:16 +01:00
parent 70ddc35340
commit 633e49c8d1
6 changed files with 16 additions and 16 deletions

View File

@@ -3628,7 +3628,7 @@ type_add_flags_W (TypeNode *node,
{
guint dflags;
g_return_if_fail ((flags & ~TYPE_FLAG_MASK) == 0);
g_return_if_fail ((flags & (unsigned) ~TYPE_FLAG_MASK) == 0);
g_return_if_fail (node != NULL);
if ((flags & TYPE_FLAG_MASK) && node->is_classed && node->data && node->data->class.class)
@@ -3725,7 +3725,7 @@ _g_type_test_flags (GType type,
node = lookup_type_node_I (type);
if (node)
{
if ((flags & ~NODE_FLAG_MASK) == 0)
if ((flags & (unsigned) ~NODE_FLAG_MASK) == 0)
{
if ((flags & G_TYPE_FLAG_CLASSED) && !node->is_classed)
return FALSE;