From: Christian Brauner Date: Tue, 5 Feb 2019 22:48:32 +0000 (+0100) Subject: compiler: -Werror=shift-overflow=2 hardening X-Git-Tag: lxc-3.2.0~165^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcfce08abac5cf1271bc3034d4017d4a714154cc;p=thirdparty%2Flxc.git compiler: -Werror=shift-overflow=2 hardening 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 --- diff --git a/configure.ac b/configure.ac index 729f262c0..c59b7664d 100644 --- a/configure.ac +++ b/configure.ac @@ -716,6 +716,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"],,[])