chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
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 1356ae99606339abc411704582202e646642cf78..fe014eda750f397a2cd3d7edbd54ca05f853ea3c 100644 (file)
@@ -386,6 +386,7 @@ endif
 #         '-Wstrict-aliasing=2',
 #         '-Wwrite-strings',
 #         '-Werror=overflow',
+#         '-Werror=shift-count-overflow',
 #         '-Wdate-time',
 #         '-Wnested-externs',
 #         '-ffast-math',
@@ -1927,6 +1928,7 @@ executable('elogind-user-runtime-dir',
 executable('elogind-user-runtime-dir',
 executable('elogind-user-runtime-dir',
 executable('elogind-user-runtime-dir',
+executable('elogind-user-runtime-dir',
 executable('elogind-user-runtime-dir',
            user_runtime_dir_sources,
            include_directories : includes,