Skip to content

compiler.get_supported_arguments rejects -Wno-vla-larger-than on gcc-like compilers #14208

@mitchgrout

Description

@mitchgrout

Describe the bug
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>.

This appears to be an intentional choice in ‎CLikeCompiler._has_multi_arguments, as it special-cases -Wno-attributes=.

To Reproduce

project('tmp', 'c')
c = meson.get_compiler('c')
c.get_supported_arguments(
  '-Wno-vla-larger-than',
  checked: 'require',
)

With a gcc-like compiler, run meson setup build and observe the output:

ERROR: Compiler for C does not support "-Wno-vla-larger-than"

From meson-logs.txt:

Command line: `gcc <dir>/testfile.c -o <dir>/output.obj -c -D_FILE_OFFSET_BITS=64 -O0 -Wvla-larger-than -Wno-vla-larger-than` -> 1
stderr:
gcc: error: unrecognized command line option '-Wvla-larger-than'; did you mean '-Wvla-larger-than='?
-----------
Compiler for C supports arguments -Wno-vla-larger-than: NO

Expected behavior
meson considers the argument valid if accepted by the compiler, even if the converse is rejected

system parameters

  • Is this a cross build or just a plain native build (for the same computer)? -- Plain, but would affect any build type
  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.) -- WSL2 under Windows 10
  • what Python version are you using e.g. 3.8.0 -- 3.8.10
  • what meson --version -- 1.1.0
  • what ninja --version if it's a Ninja build -- 1.10.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions