* [PATCH] meson: disable "maybe uninitilized" errors with -Og
@ 2026-07-27 13:30 Michael S. Tsirkin
2026-08-10 6:57 ` Michael S. Tsirkin
2026-08-10 8:26 ` Daniel P. Berrangé
0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2026-07-27 13:30 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Marc-André Lureau, Daniel P. Berrangé,
Philippe Mathieu-Daudé, Pierrick Bouvier
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 <mst@redhat.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] meson: disable "maybe uninitilized" errors with -Og
2026-07-27 13:30 [PATCH] meson: disable "maybe uninitilized" errors with -Og Michael S. Tsirkin
@ 2026-08-10 6:57 ` Michael S. Tsirkin
2026-08-10 8:28 ` Daniel P. Berrangé
2026-08-10 8:26 ` Daniel P. Berrangé
1 sibling, 1 reply; 4+ messages in thread
From: Michael S. Tsirkin @ 2026-08-10 6:57 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Marc-André Lureau, Daniel P. Berrangé,
Philippe Mathieu-Daudé, Pierrick Bouvier
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 <mst@redhat.com>
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] meson: disable "maybe uninitilized" errors with -Og
2026-07-27 13:30 [PATCH] meson: disable "maybe uninitilized" errors with -Og Michael S. Tsirkin
2026-08-10 6:57 ` Michael S. Tsirkin
@ 2026-08-10 8:26 ` Daniel P. Berrangé
1 sibling, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2026-08-10 8:26 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Paolo Bonzini, Marc-André Lureau,
Philippe Mathieu-Daudé, Pierrick Bouvier
On Mon, Jul 27, 2026 at 09:30:51AM -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 <mst@redhat.com>
> ---
> 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
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] meson: disable "maybe uninitilized" errors with -Og
2026-08-10 6:57 ` Michael S. Tsirkin
@ 2026-08-10 8:28 ` Daniel P. Berrangé
0 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrangé @ 2026-08-10 8:28 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: qemu-devel, Paolo Bonzini, Marc-André Lureau,
Philippe Mathieu-Daudé, Pierrick Bouvier
On Mon, Aug 10, 2026 at 02:57:06AM -0400, Michael S. Tsirkin wrote:
> 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 <mst@redhat.com>
>
> 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.
I see no compelling reason to disable it universally - the
problems are not too numerous, and IMHO if the code is
complex enough that the compiler is worried, then it is
better to have explicit initializers as that makes the code
easier to interpret for humans too.
>
>
> > ---
> > 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
>
With regards,
Daniel
--
|: https://berrange.com ~~ https://hachyderm.io/@berrange :|
|: https://libvirt.org ~~ https://entangle-photo.org :|
|: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-08-10 8:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-27 13:30 [PATCH] meson: disable "maybe uninitilized" errors with -Og Michael S. Tsirkin
2026-08-10 6:57 ` Michael S. Tsirkin
2026-08-10 8:28 ` Daniel P. Berrangé
2026-08-10 8:26 ` Daniel P. Berrangé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.