]> git.ipfire.org Git - thirdparty/systemd.git/commit
build-sys: disable -Wmaybe-uninitialized
authorFilipe Brandenburger <filbranden@google.com>
Thu, 6 Sep 2018 19:34:24 +0000 (12:34 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 8 Sep 2018 10:05:56 +0000 (12:05 +0200)
commit8794164fed5f0142c34358613f92f4f761af4edd
treeee1396b2669917b82305ea84ec6668b38d921b6d
parent231dca5579cfba6175d19eee5347d693893fb5aa
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.
meson.build