diff --git a/meson.build b/meson.build index abff7f522..81f33ef37 100644 --- a/meson.build +++ b/meson.build @@ -518,7 +518,16 @@ foreach m : struct_members else header_check_prefix = header_check_prefix + '#include ' endif - if cc.has_member('struct ' + m[0], m[1], prefix : header_check_prefix) + # Reimplement cc.has_member() to workaround compiler warning + # FIXME: https://github.com/mesonbuild/meson/pull/12818 + code = header_check_prefix + ''' + void bar(void) { + struct ''' + m[0] + ''' foo; + (void) ( foo.''' + m[1] + ''' ); + (void) foo; + } + ''' + if cc.compiles(code, name : 'type "struct ' + m[0] + '" has member "' + m[1] + '"') define = 'HAVE_STRUCT_@0@_@1@'.format(m[0].to_upper(), m[1].underscorify().to_upper()) glib_conf.set(define, 1) glib_conf_prefix = glib_conf_prefix + '#define @0@ 1\n'.format(define)