]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
compiler: -Werror=shift-overflow=2 hardening
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 5 Feb 2019 22:48:32 +0000 (23:48 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 10 Apr 2019 16:46:03 +0000 (18:46 +0200)
Warn about left shift overflows. This warning is enabled by default in
C99 and C++11 modes (and newer).

-Wshift-overflow=2
This warning level also warns about left-shifting 1 into the sign bit,
unless C++14 mode (or newer) is active.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
configure.ac

index 76658af283847a9627473d8a3f340d6a902bd49a..5c2e0cf73c89f96d871321a764361eb2062b09ad 100644 (file)
@@ -708,6 +708,7 @@ AX_CHECK_COMPILE_FLAG([-Wendif-labels], [CFLAGS="$CFLAGS -Wendif-labels"],,[-Wer
 AX_CHECK_COMPILE_FLAG([-Werror=overflow], [CFLAGS="$CFLAGS -Werror=overflow"],,[-Werror])
 AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], [CFLAGS="$CFLAGS -fdiagnostics-show-option"],,[-Werror])
 AX_CHECK_COMPILE_FLAG([-Werror=shift-count-overflow], [CFLAGS="$CFLAGS -Werror=shift-count-overflow"],,[-Werror])
+AX_CHECK_COMPILE_FLAG([-Werror=shift-overflow=2], [CFLAGS="$CFLAGS -Werror=shift-overflow=2"],,[-Werror])
 
 AX_CHECK_LINK_FLAG([-z relro], [LDLAGS="$LDLAGS -z relro"],,[])
 AX_CHECK_LINK_FLAG([-z now], [LDLAGS="$LDLAGS -z now"],,[])