girepository: Ignore set-but-not-used warnings with G_DISABLE_ASSERT

This fixes some compiler warnings when building with
`-Dglib_assert=false`.

See https://gitlab.gnome.org/GNOME/glib/-/jobs/3294022

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
Philip Withnall 2023-11-14 10:36:51 +00:00
parent 24776cb5bd
commit d00bbf94a6
3 changed files with 9 additions and 0 deletions

View File

@ -1314,6 +1314,9 @@ compare_version (const char *v1,
success = parse_version (v2, &v2_major, &v2_minor);
g_assert (success);
/* Avoid a compiler warning about `success` being unused with G_DISABLE_ASSERT */
(void) success;
if (v1_major > v2_major)
return 1;
else if (v2_major > v1_major)

View File

@ -413,6 +413,7 @@ gi_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
void
gi_typelib_check_sanity (void)
{
#ifndef G_DISABLE_ASSERT
/* Check that struct layout is as we expect */
gboolean size_check_ok = TRUE;
@ -461,6 +462,7 @@ gi_typelib_check_sanity (void)
#undef CHECK_SIZE
g_assert (size_check_ok);
#endif /* !G_DISABLE_ASSERT */
}

View File

@ -152,7 +152,9 @@ gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint3
guint16 *table;
GHashTableIter hashiter;
gpointer key, value;
#ifndef G_DISABLE_ASSERT
guint32 num_elts;
#endif
guint8 *packed_mem;
g_return_if_fail (builder != NULL);
@ -170,7 +172,9 @@ gi_typelib_hash_builder_pack (GITypelibHashBuilder *builder, guint8* mem, guint3
table = (guint16*) (mem + builder->dirmap_offset);
#ifndef G_DISABLE_ASSERT
num_elts = g_hash_table_size (builder->strings);
#endif
g_hash_table_iter_init (&hashiter, builder->strings);
while (g_hash_table_iter_next (&hashiter, &key, &value))
{