Skip to content

Commit

Permalink
Make vala C code errors non-fatal
Browse files Browse the repository at this point in the history
meson 1.4 stopped hiding valac's warnings [1], which fails compilation
due to our `-Werror=` settings. There's not much that we can do at this
point, so stop making them non-fatal.

This reverts the `gentoo-hacks` option from commit 539af0b. Turns
out that this wasn't a compiler change in Gentoo after all, but that
Gentoo backported [2] that meson change at that time.

Many thanks to Dominique Leuenberger @DimStar77 for tracking down the
root cause!

Fixes #228

[1] mesonbuild/meson@5f659af870011e
[2] gentoo/gentoo#34141
  • Loading branch information
martinpitt committed Mar 1, 2024
1 parent b842b14 commit 4031b37
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
30 changes: 9 additions & 21 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,37 +21,25 @@ add_project_arguments(
'-Werror=format-security',
'-Werror=format=2',
#'-Werror=missing-include-dirs',
'-Werror=unused-variable',
'-Werror=return-type',
'-Werror=uninitialized',
# experimental: first check this on all Debian architectures
'-Wcast-align',
# older gcc versions don't know about all the -Wanalyzer errors which we want to quiesce
'-Wno-error=pragmas',
# generated vala code triggers tons of these
'-Wno-error=discarded-qualifiers',
'-Wno-error=incompatible-pointer-types',
'-Wno-error=pointer-sign',
'-Wno-error=unused-but-set-variable',
'-Wno-error=unused-function',
'-Wno-error=unused-label',
'-Wno-error=unused-value',
'-Wno-error=unused-variable',
language: 'c')

add_project_arguments('--abi-stability', language: 'vala')

# let's not clutter the code with too many #ifdefs
if get_option('b_ndebug') == 'true'
add_project_arguments('-Wno-error=unused-but-set-variable', '-Wno-error=unused-variable', language: 'c')
endif

# HACK: between Jan 5 and Jan 8 2024, Gentoo changed something that causes
# hundreds of warnings when compiling the vala-generated C code; ignore these
if get_option('gentoo-hacks')
add_project_arguments(
'-Wno-error',
'-Wno-error=incompatible-pointer-types',
'-Wno-error=pointer-sign',
'-Wno-error=unused-function',
'-Wno-error=unused-label',
'-Wno-error=unused-but-set-variable',
'-Wno-error=unused-variable',
'-Wno-error=unused-value',
language: 'c')
endif

conf = configuration_data()
cc = meson.get_compiler('c')
valac = meson.get_compiler('vala')
Expand Down
5 changes: 0 additions & 5 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,3 @@ option('gtk_doc',
type : 'boolean',
value : false,
description : 'use gtk-doc to build documentation')

option('gentoo-hacks',
type : 'boolean',
value : false,
description : 'disable gcc fatal warnings, for Gentoo builds')
2 changes: 1 addition & 1 deletion tests/run-gentoo
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ git config --global safe.directory /source
cd /source
export VALAC=\$(ls /usr/bin/valac-* |sort | tail -n1)
meson setup /tmp/dbg --buildtype debug --werror -Dgentoo-hacks=true
meson setup /tmp/dbg --buildtype debug --werror
export BRITTLE_TESTS="${BRITTLE_TESTS:-}"
meson test -C /tmp/dbg -v --num-processes=1
Expand Down

0 comments on commit 4031b37

Please sign in to comment.