mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2026-10-24 00:49:00 +03:00
build: Add -Wshorten-64-to-32 warning arguments
As with `-Wsign-conversion`, these will be enabled in sections across the codebase, as there will be a lot of warnings to fix. To begin with, enable `-Wshorten-64-to-32` for the gthread subdirectory. As it happens, that doesn’t trigger any new warnings. Happy days. `-Wshorten-64-to-32` warns if a 64-bit number is assigned to a 32-bit wide storage location. It’s only available on clang. Signed-off-by: Philip Withnall <pwithnall@gnome.org> Helps: #3527
This commit is contained in:
@@ -27,7 +27,7 @@ libgthread = library('gthread-2.0',
|
||||
darwin_versions : darwin_versions,
|
||||
install : true,
|
||||
dependencies : [libglib_dep],
|
||||
c_args : ['-DG_LOG_DOMAIN="GThread"', glib_c_args_internal, warning_sign_conversion_args],
|
||||
c_args : ['-DG_LOG_DOMAIN="GThread"', glib_c_args_internal, warning_sign_conversion_args, warning_shorten_64_to_32_args],
|
||||
gnu_symbol_visibility : 'hidden',
|
||||
link_args : glib_link_flags,
|
||||
)
|
||||
|
||||
@@ -7,7 +7,7 @@ test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
||||
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
||||
|
||||
test_deps = [thread_dep, libglib_dep, libgthread_dep, app_profile_dep]
|
||||
test_cargs = ['-DG_LOG_DOMAIN="GLib-GThread"', '-UG_DISABLE_ASSERT', warning_sign_conversion_args]
|
||||
test_cargs = ['-DG_LOG_DOMAIN="GLib-GThread"', '-UG_DISABLE_ASSERT', warning_sign_conversion_args, warning_shorten_64_to_32_args]
|
||||
test_cpp_args = test_cargs
|
||||
|
||||
foreach test_name, extra_args : gthread_tests
|
||||
|
||||
@@ -667,6 +667,10 @@ endif
|
||||
# removed. See https://gitlab.gnome.org/GNOME/glib/-/issues/3405
|
||||
warning_sign_conversion_args = cc.get_supported_arguments(['-Wsign-conversion'])
|
||||
|
||||
# FIXME: As above
|
||||
# See https://gitlab.gnome.org/GNOME/glib/-/issues/3527
|
||||
warning_shorten_64_to_32_args = cc.get_supported_arguments(['-Wshorten-64-to-32'])
|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user