]> arthur.barton.de Git - ngircd.git/commitdiff
Use -Werror when testing for -Wno-format-truncation
authorAlexander Barton <alex@barton.de>
Fri, 19 Jan 2024 15:55:23 +0000 (16:55 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 19 Jan 2024 16:07:47 +0000 (17:07 +0100)
Clang does not know the -Wno-format-truncation option of (current) GCC,
but accepts unknown -W... options (exit core 0) but issues a warning
message on every invocation. So for example on macOS, where Clang is
used as "gcc", a new warning message was shown for every file to
compile, since we enabled -Wno-format-truncation in commit 1d527eaf:

  warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]

Clang no longer acceps unknown -W... options by enabling -Werror, which
this patch adds to the CFLAGS while testing for -Wno-format-truncation,
which fixes this issue.

This fixes commit 1d527eaf.

configure.ng

index b2652c64aed63f61442a31a888f4f3e09483fd0a..346b6aa87ebb9187e0a320bd7b116a3713e87853 100644 (file)
@@ -129,10 +129,12 @@ AC_DEFUN([GCC_W_NO_FORMAT_TRUNC],[
        result=yes
        AC_MSG_CHECKING([whether ${CC} accepts -Wno-format-truncation])
        old_cflags="$CFLAGS"
-       CFLAGS="$CFLAGS -Wno-format-truncation"
+       CFLAGS="$CFLAGS -Werror -Wno-format-truncation"
        AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],[],[result=no])
        echo $result
-       if test "X$result" = "Xno"; then
+       if test "X$result" = "Xyes"; then
+               CFLAGS="$old_cflags -Wno-format-truncation"
+       else
                CFLAGS="$old_cflags"
        fi
 ])