tests: Add a -Wsign-conversion test for gstring.h

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 <pwithnall@endlessos.org>

Helps: #2919
This commit is contained in:
Philip Withnall 2023-02-15 14:29:04 +00:00
parent 0bdf7fcce4
commit bc53fff8a3

View File

@ -129,6 +129,11 @@ glib_tests = {
}, },
'strfuncs' : {}, 'strfuncs' : {},
'string' : {}, 'string' : {},
'string-macro' : {
'source' : 'string.c',
'c_args' : cc.get_id() == 'gcc' ? ['-Werror=sign-conversion'] : [],
'install' : false,
},
'strvbuilder' : {}, 'strvbuilder' : {},
'testing' : { 'testing' : {
'args': [ '--verbose' ], 'args': [ '--verbose' ],