https://github.com/royhills/ike-scan/pull/39 From 9949ce4bdf9f4bcb616b2a5d273708a7ea9ee93d Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 26 Sep 2022 05:22:18 +0100 Subject: [PATCH 1/3] acinclude.m4: fix -Wimplicit-int errors (Clang 16+ compat) --- a/acinclude.m4 +++ b/acinclude.m4 @@ -144,7 +144,7 @@ int does_int64_work() return 0; return 1; } -main() { +int main() { return ! does_int64_work(); }], [Ac_cachevar=yes], @@ -200,7 +200,7 @@ int does_int64_snprintf_work() return 0; /* either multiply or snprintf is busted */ return 1; } -main() { +int main() { return ! does_int64_snprintf_work(); }], [pgac_cv_snprintf_long_long_int_format=$pgac_format; break], From 6a931ca559a937cb9f7917b9131ec1aca4919683 Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 26 Sep 2022 05:23:06 +0100 Subject: [PATCH 2/3] acinclude.m4: fix typo in 'x' if check Case doesn't matter but case does need to match on left & right hand side, so just choose uppercase everywhere to match what the rest of the file does. --- a/acinclude.m4 +++ b/acinclude.m4 @@ -278,7 +278,7 @@ dnl in . We don't use __GNUC_PREREQ directly because dnl is not present on all the operating systems that we support, e.g. OpenBSD. dnl AC_DEFUN([GCC_FORTIFY_SOURCE],[ - if test "x$CC" != "X"; then + if test "X$CC" != "X"; then AC_MSG_CHECKING([whether ${CC} accepts -D_FORTIFY_SOURCE]) AC_TRY_COMPILE(,[ #define GNUC_PREREQ(maj, min) ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min)) @@ -311,7 +311,7 @@ dnl If it is not supported, then the test program will compile without dnl warnings. dnl AC_DEFUN([GCC_FORMAT_SECURITY],[ - if test "x$CC" != "X"; then + if test "X$CC" != "X"; then AC_MSG_CHECKING([whether ${CC} accepts -Wformat-security]) wfs_old_cflags="$CFLAGS" CFLAGS="$CFLAGS -Wall -Werror -Wformat -Wformat-security" From fbc40c7b117b523eceb9aa58d6086bde701f1299 Mon Sep 17 00:00:00 2001 From: Sam James Date: Sat, 1 Oct 2022 01:24:04 +0100 Subject: [PATCH 3/3] configure.ac: Fix recognising -Wformat-security with Clang Before: ``` checking whether clang accepts -fstack-protector... yes checking whether clang accepts -D_FORTIFY_SOURCE... yes checking whether clang accepts -Wformat-security... no ``` After: ``` checking whether clang accepts -fstack-protector... yes checking whether clang accepts -Wformat-security... yes checking whether clang accepts -D_FORTIFY_SOURCE... yes ``` Signed-off-by: Sam James --- a/configure.ac +++ b/configure.ac @@ -34,8 +34,8 @@ if test -n "$GCC"; then CFLAGS="$CFLAGS -Wall -Wshadow -Wwrite-strings" GCC_WEXTRA GCC_STACK_PROTECT_CC - GCC_FORTIFY_SOURCE GCC_FORMAT_SECURITY + GCC_FORTIFY_SOURCE dnl Uncomment the lines below for testing with stricter warnings. dnl CFLAGS="$CFLAGS -pedantic -Wpointer-arith -Wcast-qual -Wcast-align -Wconversion -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline " dnl Uncomment the line below to check malloc/free with electric fence