Skip to content

Commit eca1ac1

Browse files
bonzinijpakkane
authored andcommitted
c: add -Wno-vla-larger-than to the exceptions for -Wno*
When supplying -Wno-vla-larger-than to compiler.get_supported_arguments, meson will inject -Wvla-larger-than as an argument which considered invalid by GCC, as the converse argument is -Wvla-larger-than=<value>. Just like CLikeCompiler._has_multi_arguments special-cases -Wno-attributes=, do the same for -Wno-vla-larger-than. Resolves: #14208 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 7f8bef1 commit eca1ac1

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

mesonbuild/compilers/mixins/clike.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,10 +1285,16 @@ def _has_multi_arguments(self, args: T.List[str], env: 'Environment', code: str)
12851285
# some compilers, e.g. GCC, don't warn for unsupported warning-disable
12861286
# flags, so when we are testing a flag like "-Wno-forgotten-towel", also
12871287
# check the equivalent enable flag too "-Wforgotten-towel".
1288-
# Make an exception for -Wno-attributes=x as -Wattributes=x is invalid
1289-
# for GCC at least.
1290-
if arg.startswith('-Wno-') and not arg.startswith('-Wno-attributes='):
1291-
new_args.append('-W' + arg[5:])
1288+
if arg.startswith('-Wno-'):
1289+
# Make an exception for -Wno-attributes=x as -Wattributes=x is invalid
1290+
# for GCC at least. Also, the opposite of -Wno-vla-larger-than is
1291+
# -Wvla-larger-than=N
1292+
if arg.startswith('-Wno-attributes='):
1293+
pass
1294+
elif arg == '-Wno-vla-larger-than':
1295+
new_args.append('-Wvla-larger-than=1000')
1296+
else:
1297+
new_args.append('-W' + arg[5:])
12921298
if arg.startswith('-Wl,'):
12931299
mlog.warning(f'{arg} looks like a linker argument, '
12941300
'but has_argument and other similar methods only '

test cases/common/104 has arg/meson.build

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ if cpp.get_id() == 'gcc' and cpp.version().version_compare('>=12.1.0')
5656
# Handle special -Wno-attributes=foo where -Wattributes=foo is invalid
5757
# i.e. our usual -Wno-foo -Wfoo hack doesn't work for -Wattributes=foo.
5858
assert(cpp.has_argument('-Wno-attributes=meson::i_do_not_exist'))
59+
# Likewise, the positive counterpart to -Wno-vla-larger-than is
60+
# -Wvla-larger-than=N
61+
assert(cpp.has_argument('-Wno-vla-larger-than'))
5962
endif
6063

6164
if cc.get_id() == 'clang' and cc.version().version_compare('<=4.0.0')

0 commit comments

Comments
 (0)