Re: [PATCH] meson: disable "maybe uninitilized" errors with -Og

"Michael S. Tsirkin" <[email protected]>
Newsgroups org.nongnu.qemu-devel
Message-ID <[email protected]>
On Mon, Jul 27, 2026 at 09:30:54AM -0400, Michael S. Tsirkin wrote:
> GCC's "maybe uninitilized" warnings depend on optimizations
> for code flow analysis, and produce false positive errors
> with -Og. Default build gives us coverage with that,
> so let's just disable with -Og.
> 
> Signed-off-by: Michael S. Tsirkin <[email protected]>

ping, comments on this?

As an alternative, I can see us doing this for everyone
and only adding -Werror=maybe-uninitialized in CI for
known good compiler/flag combos which do not produce
too many false positives.


> ---
>  meson.build | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/meson.build b/meson.build
> index 164328ded8..a119dae6ac 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -742,6 +742,10 @@ warn_flags = [
>    '-Wno-typedef-redefinition',
>  ]
>  
> +if get_option('optimization') == 'g'
> +  warn_flags += ['-Wno-error=maybe-uninitialized']
> +endif
> +
>  if host_os != 'darwin'
>    tsa_has_cleanup = cc.compiles('''
>      struct __attribute__((capability("mutex"))) mutex {};
> -- 
> MST
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.