]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: do not allow bit-shift overflows
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 9 Jun 2018 11:12:52 +0000 (13:12 +0200)
committerFilipe Brandenburger <filbranden@google.com>
Sat, 9 Jun 2018 19:42:30 +0000 (12:42 -0700)
The primary motivation is to catch enum values created through a shift that is
too big:

../src/test/test-sizeof.c:26:29: error: left shift count >= width of type [-Werror=shift-count-overflow]
         enum_with_shift = 1 << 32,
                             ^~
cc1: some warnings being treated as errors

The compiler will now reject those.

This is an alternative to #9224.

meson.build

index a4c2368df945fc59034c2b4cc9b7963a3441d9e2..29ee446d564b7abcf52e2370e9d42bc757d4dd77 100644 (file)
@@ -319,6 +319,7 @@ possible_cc_flags = [
         '-Wstrict-aliasing=2',
         '-Wwrite-strings',
         '-Werror=overflow',
+        '-Werror=shift-count-overflow',
         '-Wdate-time',
         '-Wnested-externs',
         '-ffast-math',