From bc53fff8a30731d38919481392e5faa11d5b9fbb Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 15 Feb 2023 14:29:04 +0000 Subject: [PATCH] tests: Add a -Wsign-conversion test for gstring.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While it’s not possible to build GLib with `-Wsign-conversion` enabled (there are too many warnings), it would be useful to check that GLib’s public headers can be used with `-Wsign-conversion` enabled, as some projects want to do that. For example, dnf5 is built that way (see issue #2919). Add a simple regression test for this, by re-building the `gstring` tests with `-Wsign-conversion` enabled. Since they include `glib.h`, this will test all the public libglib headers by proxy. Since this is a compile-only test, it doesn’t need to be installed. Signed-off-by: Philip Withnall Helps: #2919 --- glib/tests/meson.build | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/glib/tests/meson.build b/glib/tests/meson.build index a1626aa52..e25180849 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build @@ -129,6 +129,11 @@ glib_tests = { }, 'strfuncs' : {}, 'string' : {}, + 'string-macro' : { + 'source' : 'string.c', + 'c_args' : cc.get_id() == 'gcc' ? ['-Werror=sign-conversion'] : [], + 'install' : false, + }, 'strvbuilder' : {}, 'testing' : { 'args': [ '--verbose' ],