From a4c5b26cea1ecf3dd97a484cf9526df9525e4e17 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Sat, 10 Oct 2020 14:56:52 +0100 Subject: [PATCH 1/2] Add -Wno-logical-op compiler flag to Sodium extension --- ext/sodium/config.m4 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ext/sodium/config.m4 b/ext/sodium/config.m4 index 0676b6691068..05d9ebd5a13d 100644 --- a/ext/sodium/config.m4 +++ b/ext/sodium/config.m4 @@ -11,8 +11,9 @@ if test "$PHP_SODIUM" != "no"; then AC_DEFINE(HAVE_LIBSODIUMLIB, 1, [ ]) - dnl Add -Wno-type-limits as this may arise on 32bits platforms + dnl Add -Wno-type-limits and -Wno-logical-op as this may arise on 32bits platforms SODIUM_COMPILER_FLAGS="$LIBSODIUM_CFLAGS -Wno-type-limits" + AX_CHECK_COMPILE_FLAG([-Wno-logical-op], SODIUM_COMPILER_FLAGS="$SODIUM_COMPILER_FLAGS -Wno-logical-op", , [-Werror]) PHP_NEW_EXTENSION(sodium, libsodium.c sodium_pwhash.c, $ext_shared, , $SODIUM_COMPILER_FLAGS) PHP_SUBST(SODIUM_SHARED_LIBADD) fi From ab5b59fe892df3997b514051d940c4cd5f8e38c8 Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Tue, 14 Apr 2020 22:32:10 +0200 Subject: [PATCH 2/2] Add compiler flags which aren't included in -Wall or -Wextra Adds the following compiler flags: . -Wduplicated-cond . -Wlogical-op . -Wformat-truncation . -fno-common --- Zend/Zend.m4 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 726188597496..0a9170709d85 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -215,6 +215,10 @@ fi test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-sign-compare $CFLAGS" dnl Check if compiler supports -Wno-clobbered (only GCC) AX_CHECK_COMPILE_FLAG([-Wno-clobbered], CFLAGS="-Wno-clobbered $CFLAGS", , [-Werror]) +AX_CHECK_COMPILE_FLAG([-Wduplicated-cond], CFLAGS="-Wduplicated-cond $CFLAGS", , [-Werror]) +AX_CHECK_COMPILE_FLAG([-Wlogical-op], CFLAGS="-Wlogical-op $CFLAGS", , [-Werror]) +AX_CHECK_COMPILE_FLAG([-Wformat-truncation], CFLAGS="-Wformat-truncation $CFLAGS", , [-Werror]) +AX_CHECK_COMPILE_FLAG([-fno-common], CFLAGS="-fno-common $CFLAGS", , [-Werror]) test -n "$DEBUG_CFLAGS" && CFLAGS="$CFLAGS $DEBUG_CFLAGS"