From: W.C.A. Wijngaards Date: Thu, 6 Nov 2025 14:03:17 +0000 (+0100) Subject: - Fix configure test for nonstring attribute so that it does not X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e887a79a92c0aef032eb4590e2a58052e4705710;p=thirdparty%2Funbound.git - Fix configure test for nonstring attribute so that it does not accept when the compiler prints a warning about an unknown attribute. --- diff --git a/acx_nlnetlabs.m4 b/acx_nlnetlabs.m4 index c8195f5e1..5a71c7cce 100644 --- a/acx_nlnetlabs.m4 +++ b/acx_nlnetlabs.m4 @@ -2,7 +2,9 @@ # Copyright 2009, Wouter Wijngaards, NLnet Labs. # BSD licensed. # -# Version 50 +# Version 51 +# 2025-11-06 Fix ACX_CHECK_NONSTRING_ATTRIBUTE to reject clang, that prints +# a warning for 'unknown attribute' when nonstring is used. # 2025-09-29 add ac_cv_func_malloc_0_nonnull as a cache value for the malloc(0) # check by ACX_FUNC_MALLOC. # 2025-09-29 add ACX_CHECK_NONSTRING_ATTRIBUTE, AHX_CONFIG_NONSTRING_ATTRIBUTE. @@ -535,6 +537,9 @@ dnl result in HAVE_ATTR_NONSTRING. dnl Make sure you include AHX_CONFIG_NONSTRING_ATTRIBUTE also. AC_DEFUN([ACX_CHECK_NONSTRING_ATTRIBUTE], [AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([ACX_CHECK_ERROR_FLAGS]) +BAKCFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $ERRFLAG" AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "nonstring" attribute) AC_CACHE_VAL(ac_cv_c_nonstring_attribute, [ac_cv_c_nonstring_attribute=no @@ -546,6 +551,7 @@ struct test { struct test t = { "1" }; (void) t; ]])],[ac_cv_c_nonstring_attribute="yes"],[ac_cv_c_nonstring_attribute="no"]) +CFLAGS="$BAKCFLAGS" ]) dnl Setup ATTR_NONSTRING config.h parts. diff --git a/configure b/configure index d3fdc3d58..b239cd2da 100755 --- a/configure +++ b/configure @@ -6949,6 +6949,9 @@ printf "%s\n" "#define HAVE_ATTR_UNUSED 1" >>confdefs.h fi + +BAKCFLAGS="$CFLAGS" +CFLAGS="$CFLAGS $ERRFLAG" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"nonstring\" attribute" >&5 printf %s "checking whether the C compiler (${CC-cc}) accepts the \"nonstring\" attribute... " >&6; } if test ${ac_cv_c_nonstring_attribute+y} @@ -6981,6 +6984,7 @@ else $as_nop ac_cv_c_nonstring_attribute="no" fi rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +CFLAGS="$BAKCFLAGS" fi @@ -7059,7 +7063,14 @@ else $as_nop cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include -__attribute__((noreturn)) void f(int x) { printf("%d", x); } +#ifdef STDC_HEADERS +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +__attribute__((noreturn)) void f(int x) { printf("%d", x); exit(1); } int main (void) diff --git a/doc/Changelog b/doc/Changelog index f12753096..a6f5e9e5a 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,9 @@ - Fix add comment to worker_handle_request function that explain it. - Fix configure test for noreturn attribute so it compiles without warning. + - Fix configure test for nonstring attribute so that it does not + accept when the compiler prints a warning about an unknown + attribute. 4 November 2025: Wouter - Fix dns64 log output to log the default instead of a null string.