gobject: Enable -Wsign-conversion for gobject subdirectory

Fixing #3405 is going to take a lot of work, so let’s split it up into
pieces and work on them separately. The `gobject/` and `gobject/tests/`
directories now compile cleanly with `-Wsign-conversion` (see the
previous commits), so let’s enable the warning for those directories to
prevent regressions while we continue to work on the other directories.

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

Helps: #3405
This commit is contained in:
Philip Withnall 2025-04-11 17:05:46 +01:00
parent e27d64e651
commit 4ddea1f6c0
No known key found for this signature in database
GPG Key ID: C5C42CFB268637CA
3 changed files with 9 additions and 2 deletions

View File

@ -147,7 +147,7 @@ libgobject = library('gobject-2.0',
install : true,
include_directories : [configinc],
dependencies : [libffi_dep, libglib_dep],
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'],
c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION', warning_sign_conversion_args],
gnu_symbol_visibility : 'hidden',
link_args : glib_link_flags,
)

View File

@ -179,7 +179,7 @@ test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
test_deps = [libm, thread_dep, libglib_dep, libgobject_dep]
test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"', '-UG_DISABLE_ASSERT']
test_cargs = ['-DG_LOG_DOMAIN="GLib-GObject"', '-UG_DISABLE_ASSERT', warning_sign_conversion_args]
test_cpp_args = test_cargs
foreach test_name, extra_args : gobject_tests

View File

@ -660,6 +660,13 @@ if have_cxx
add_project_arguments(cxx.get_supported_arguments(warning_cxx_args), language: 'cpp')
endif
# FIXME: This is checked and implemented separately from warning_common_args for
# now because it causes so many warnings. Adding it as a variable in various
# directories allows us to gradually tighten up support for it. Eventually, the
# warning can be enabled unconditionally in warning_c_args, and this variable
# removed. See https://gitlab.gnome.org/GNOME/glib/-/issues/3405
warning_sign_conversion_args = cc.get_supported_arguments(['-Wsign-conversion'])
# FIXME: We cannot build some of the GResource tests with -z nodelete, which
# means we cannot use that flag in add_project_link_arguments(), and must add
# it to the relevant targets manually. We do the same with -Bsymbolic-functions