From 0ff45ab1491f17a033e3f1fd200352ef2d7d9c10 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Wed, 29 Jul 2026 10:35:29 -0500 Subject: [PATCH 1/2] Fixed m4/cf3_gcc_flags.m4 to actually test compiler flags Previously the compile check was not using any CFLAGS to test if the compile flags were supported. This was broken for CFE-3629 in commit 257982dd37738dde724f621ceff696cd3b9fd39b Ticket: ENT-14382 Changelog: none --- m4/cf3_gcc_flags.m4 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/m4/cf3_gcc_flags.m4 b/m4/cf3_gcc_flags.m4 index 3db7eb19..dcc42427 100644 --- a/m4/cf3_gcc_flags.m4 +++ b/m4/cf3_gcc_flags.m4 @@ -47,25 +47,31 @@ if test x"$GCC" = "xyes" && test x"$HP_UX_AC" != x"yes"; then CF3_CFLAGS="$CF3_CFLAGS -std=gnu99 -g -Wall" AC_MSG_RESULT(yes) + dnl Save CFLAGS to restore after using it to test for compiler flag support + save_CFLAGS="$CFLAGS" AC_MSG_CHECKING(for -Wno-pointer-sign) + CFLAGS="-Wno-pointer-sign" AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() {}])], [AC_MSG_RESULT(yes) CF3_CFLAGS="$CF3_CFLAGS -Wno-pointer-sign"], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for -Werror=implicit-function-declaration) + CFLAGS="-Werror=implicit-function-declaration" AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() {}])], [AC_MSG_RESULT(yes) CF3_CFLAGS="$CF3_CFLAGS -Werror=implicit-function-declaration"], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for -Wunused-parameter) + CFLAGS="-Wunused-parameter" AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() {}])], [AC_MSG_RESULT(yes) CF3_CFLAGS="$CF3_CFLAGS -Wunused-parameter"], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for -Wno-incompatible-pointer-types) + CFLAGS="-Wno-incompatible-pointer-types" AC_COMPILE_IFELSE([AC_LANG_SOURCE([int main() {}])], [AC_MSG_RESULT(yes) CF3_CFLAGS="$CF3_CFLAGS -Wno-incompatible-pointer-types"], @@ -78,6 +84,7 @@ if test x"$GCC" = "xyes" && test x"$HP_UX_AC" != x"yes"; then dnl GCC irregularities checking for -Wno-* command-line options dnl (command line is not fully checked until actual warning occurs) AC_MSG_CHECKING(for -Wno-duplicate-decl-specifier) + CFLAGS="-Wno-duplicate-decl-specifier" AC_COMPILE_IFELSE([AC_LANG_SOURCE([#ifndef __clang__ # error Not a clang #endif @@ -90,3 +97,5 @@ else fi AC_SUBST([CF3_CFLAGS]) +dnl restore CFLAGS +CFLAGS="$save_CFLAGS" From a90a9e0d8d38a8c6bbc433b28e656ac964227bd9 Mon Sep 17 00:00:00 2001 From: Craig Comstock Date: Wed, 29 Jul 2026 11:54:36 -0500 Subject: [PATCH 2/2] bump copyright year in m4/cf3_gcc_flags.m4 --- m4/cf3_gcc_flags.m4 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/m4/cf3_gcc_flags.m4 b/m4/cf3_gcc_flags.m4 index dcc42427..f28ae0bd 100644 --- a/m4/cf3_gcc_flags.m4 +++ b/m4/cf3_gcc_flags.m4 @@ -1,5 +1,5 @@ # -# Copyright 2021 Northern.tech AS +# Copyright 2026 Northern.tech AS # # This file is part of CFEngine 3 - written and maintained by Northern.tech AS. #