]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix configure test for nonstring attribute so that it does not master
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 6 Nov 2025 14:03:17 +0000 (15:03 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Thu, 6 Nov 2025 14:03:17 +0000 (15:03 +0100)
  accept when the compiler prints a warning about an unknown
  attribute.

acx_nlnetlabs.m4
configure
doc/Changelog

index c8195f5e1001073ad6cfa3d3fcc9293486b93af5..5a71c7cce203eadeb19e715814304d45ebc69886 100644 (file)
@@ -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.
index d3fdc3d585e5e5b4125ed7aa883cb03de74134ce..b239cd2da314a5c736d7e19db2a0d3f76a7c0ff1 100755 (executable)
--- 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 <stdio.h>
-__attribute__((noreturn)) void f(int x) { printf("%d", x); }
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+#else
+# ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+__attribute__((noreturn)) void f(int x) { printf("%d", x); exit(1); }
 
 int
 main (void)
index f127530968de686d99354869b54e7beaa6d4a3cd..a6f5e9e5ac8b56a5a255a909685d5d98cb56ccf1 100644 (file)
@@ -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.