From fcfce08abac5cf1271bc3034d4017d4a714154cc Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 5 Feb 2019 23:48:32 +0100 Subject: [PATCH] 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 --- configure.ac | 1 + 1 file changed, 1 insertion(+) 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"],,[])