summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorFilipe Brandenburger <filbranden@google.com>2018-09-06 12:34:24 -0700
committerSven Eden <sven.eden@prydeworx.com>2018-10-29 10:18:25 +0100
commit899aa62775475073069a53d374b7df63ad797dea (patch)
treed86363421f0e96d74e6df7c826eb6275d7d502fd /meson.build
parentc235b61057a1a48c4262d12f3bb6676aac143dc3 (diff)
build-sys: disable -Wmaybe-uninitialized
Compiler flag -Wmaybe-uninitialized is quite noisy and produces many false positives, especially when optimization flags are enabled (tested gcc 8.2.1), so let's just disable it in systemd build. For example, with CFLAGS=-O2, the build produces 11 such warnings and the default CFLAGS of Fedora's rpmbuild warns about it in 176 places. A look at a sample of those shows that most are false positives, where the compiler just can't figure it out correctly. (While fixing those would be nice, I'm not sure it's a good use of our time.) The noisy [-Wmaybe-uninitialized] warnings are not just an annoyance, since they make it harder to spot warnings that indicate actual problems (such as variable declared but not used.) Silencing those is beneficial, so that contributors would see warnings where there are actually actionable problems, so there's a better chance of having those issues addressed before a PR is pushed. Tested: $ CFLAGS='-O2 -Wp,-D_FORTIFY_SOURCE=2' meson build/ $ ninja -C build/ (NOTE: -Wp,-D_FORTIFY_SOURCE=2 prevents [-Wstringop-truncation] warnings.) With the commands above, the build will not produce any [-Wmaybe-uninitialized] warnings (or any other warnings), which is not really the case before this commit. Also tested with rpmbuild on Fedora, after this commit there are no warnings produced in the build step. (cherry picked from commit 8794164fed5f0142c34358613f92f4f761af4edd)
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build4
1 files changed, 4 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index a70f538c6..09ba87c27 100644
--- a/meson.build
+++ b/meson.build
@@ -445,6 +445,10 @@ foreach arg : ['unused-parameter',
'unused-result',
'format-signedness',
'error=nonnull', # work-around for gcc 7.1 turning this on on its own
+
+ # Disable -Wmaybe-uninitialized, since it's noisy on gcc 8 with
+ # optimizations enabled, producing essentially false positives.
+ 'maybe-uninitialized',
]
if cc.has_argument('-W' + arg)
add_project_arguments('-Wno-' + arg, language : 'c')