diff options
author | Eric Blake <eblake@redhat.com> | 2020-03-17 12:55:34 -0500 |
---|---|---|
committer | John Snow <jsnow@redhat.com> | 2020-03-18 14:03:46 -0400 |
commit | 9bda600b0833821685e23068e50be5134dc0ab05 (patch) | |
tree | 814ff0dd4076c651236a5387d4b72f1e5eba6166 /configure | |
parent | d649689a8ecb2e276cc20d3af6d416e3c299cb17 (diff) |
build: Silence clang warning on older glib autoptr usage
glib's G_DEFINE_AUTOPTR_CLEANUP_FUNC() macro defines several static
inline functions, often with some of them unused, but prior to 2.57.2
did not mark the functions as such. As a result, clang (but not gcc)
fails to build with older glib unless -Wno-unused-function is enabled.
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20200317175534.196295-1-eblake@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -3851,6 +3851,26 @@ if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then fi fi +# Silence clang warnings triggered by glib < 2.57.2 +cat > $TMPC << EOF +#include <glib.h> +typedef struct Foo { + int i; +} Foo; +static void foo_free(Foo *f) +{ + g_free(f); +} +G_DEFINE_AUTOPTR_CLEANUP_FUNC(Foo, foo_free); +int main(void) { return 0; } +EOF +if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then + if cc_has_warning_flag "-Wno-unused-function"; then + glib_cflags="$glib_cflags -Wno-unused-function" + CFLAGS="$CFLAGS -Wno-unused-function" + fi +fi + ######################################### # zlib check |