Skip to content

[1.8] Cannot set per-project warning_level&werror from the parent project's default_options #14528

@cfillion

Description

@cfillion

Overriding the warning level and -Werror in select subprojects from the parent project(default_options: [...]) broke in Meson 1.8.

project('test', 'c',
  version: 'unknown',
  meson_version: '>= 1.7',
  default_options: [
    'warning_level=2',
    'werror=true',
    'subprj:my_option=disabled',
    'subprj:warning_level=0',
    'subprj:werror=false',
  ])

Meson 1.7.2: no warnings nor errors are generated.

Meson 1.8:

[1/2] Compiling C object subprojects/subprj/libfoo.so.p/foo.c.o
FAILED: subprojects/subprj/libfoo.so.p/foo.c.o 
cc -Isubprojects/subprj/libfoo.so.p -Isubprojects/subprj -I../subprojects/subprj -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -O0 -g -fPIC -MD -MQ subprojects/subprj/libfoo.so.p/foo.c.o -MF subprojects/subprj/libfoo.so.p/foo.c.o.d -o subprojects/subprj/libfoo.so.p/foo.c.o -c ../subprojects/subprj/foo.c
../subprojects/subprj/foo.c: In function ‘main’:
../subprojects/subprj/foo.c:2:7: error: unused variable ‘unused’ [-Werror=unused-variable]
    2 |   int unused = 42;
      |       ^~~~~~
cc1: all warnings being treated as errors

I've setup a minimal project that duplicates this at https://github.com/cfillion/test_meson_1.8.

Overriding via the command line instead of within meson.build works as expected (meson setup build -Dsubprj:warning_level=0. Same with werror=false.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions