[PATCH] meson.build: Remove the -Wvla-larger-then flag

Thomas Huth posted 1 patch 2 years, 11 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210527103736.338245-1-thuth@redhat.com
meson.build | 1 -
1 file changed, 1 deletion(-)
[PATCH] meson.build: Remove the -Wvla-larger-then flag
Posted by Thomas Huth 2 years, 11 months ago
The flag has a typo in it, it's "...-than=..." and not "...-then=...",
so this was in fact never used. Since we're also using -Wvla (without
size), we should already get warnings about any variable length arrays
anyway, so the additional "-Wvla-larger-than" does not make much sense
and thus we can simply drop this.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 meson.build | 1 -
 1 file changed, 1 deletion(-)

diff --git a/meson.build b/meson.build
index 4f23f9104e..40c841e777 100644
--- a/meson.build
+++ b/meson.build
@@ -390,7 +390,6 @@ cc_flags += [
   '-Wvariadic-macros',
   '-Wvector-operation-performance',
   '-Wvla',
-  '-Wvla-larger-then=4031',
   '-Wvolatile-register-var',
   '-Wwrite-strings',
 ]
-- 
2.27.0

Re: [PATCH] meson.build: Remove the -Wvla-larger-then flag
Posted by Jano Tomko 2 years, 10 months ago

On 5/27/21 12:37 PM, Thomas Huth wrote:
> The flag has a typo in it, it's "...-than=..." and not "...-then=...",
> so this was in fact never used. Since we're also using -Wvla (without
> size), we should already get warnings about any variable length arrays
> anyway, so the additional "-Wvla-larger-than" does not make much sense
> and thus we can simply drop this.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  meson.build | 1 -
>  1 file changed, 1 deletion(-)
> 

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano

Re: [PATCH] meson.build: Remove the -Wvla-larger-then flag
Posted by Martin Kletzander 2 years, 11 months ago
On Thu, May 27, 2021 at 12:37:36PM +0200, Thomas Huth wrote:
>The flag has a typo in it, it's "...-than=..." and not "...-then=...",
>so this was in fact never used. Since we're also using -Wvla (without
>size), we should already get warnings about any variable length arrays
>anyway, so the additional "-Wvla-larger-than" does not make much sense
>and thus we can simply drop this.
>
>Signed-off-by: Thomas Huth <thuth@redhat.com>
>---
> meson.build | 1 -
> 1 file changed, 1 deletion(-)
>

This makes sense to me and I could not find any possible typo alias
anywhere (like we have in virsh, for example).  The only thing I am
unsure about is whether we want to actually use the proper naming.  The
reason is that by default this is set to vla-larger-than=PTRDIFF_MAX
which is pretty huge number.  On the other hand the man page for GCC
says it is only effective with -ftree-vrp (-02 and above).

I do not see whether using the predefined alloc_max would make sense or
not.  So I am not against just removing it, but feel free to overrule me
as I did not look into this as much as others will be capable of.

Reviewed-by: Martin Kletzander <mkletzan@redhat.com>

>diff --git a/meson.build b/meson.build
>index 4f23f9104e..40c841e777 100644
>--- a/meson.build
>+++ b/meson.build
>@@ -390,7 +390,6 @@ cc_flags += [
>   '-Wvariadic-macros',
>   '-Wvector-operation-performance',
>   '-Wvla',
>-  '-Wvla-larger-then=4031',
>   '-Wvolatile-register-var',
>   '-Wwrite-strings',
> ]
>-- 
>2.27.0
>
Re: [PATCH] meson.build: Remove the -Wvla-larger-then flag
Posted by Daniel P. Berrangé 2 years, 11 months ago
On Thu, May 27, 2021 at 12:49:28PM +0200, Martin Kletzander wrote:
> On Thu, May 27, 2021 at 12:37:36PM +0200, Thomas Huth wrote:
> > The flag has a typo in it, it's "...-than=..." and not "...-then=...",
> > so this was in fact never used. Since we're also using -Wvla (without
> > size), we should already get warnings about any variable length arrays
> > anyway, so the additional "-Wvla-larger-than" does not make much sense
> > and thus we can simply drop this.
> > 
> > Signed-off-by: Thomas Huth <thuth@redhat.com>
> > ---
> > meson.build | 1 -
> > 1 file changed, 1 deletion(-)
> > 
> 
> This makes sense to me and I could not find any possible typo alias
> anywhere (like we have in virsh, for example).  The only thing I am
> unsure about is whether we want to actually use the proper naming.  The
> reason is that by default this is set to vla-larger-than=PTRDIFF_MAX
> which is pretty huge number.  On the other hand the man page for GCC
> says it is only effective with -ftree-vrp (-02 and above).

The -Wvla-larger-than=PTRDIFF_MAX default is irrelevant though,
because we've blocked all use of VLAs by using -Wvla.

IOW, AFAICT, -Wvla-larger-than and -Wvla are mutually exclusive
from a conceptual POV.

> 
> I do not see whether using the predefined alloc_max would make sense or
> not.  So I am not against just removing it, but feel free to overrule me
> as I did not look into this as much as others will be capable of.
> 
> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
> 
> > diff --git a/meson.build b/meson.build
> > index 4f23f9104e..40c841e777 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -390,7 +390,6 @@ cc_flags += [
> >   '-Wvariadic-macros',
> >   '-Wvector-operation-performance',
> >   '-Wvla',
> > -  '-Wvla-larger-then=4031',
> >   '-Wvolatile-register-var',
> >   '-Wwrite-strings',
> > ]
> > -- 
> > 2.27.0
> > 



Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|