From: Paul Eggert Date: Mon, 1 Jan 2024 03:48:24 +0000 (-0800) Subject: maint: pacify recent clang better X-Git-Tag: v9.5~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=752ccef3eb17376ee5037efd289e64ad583e4588;p=thirdparty%2Fcoreutils.git maint: pacify recent clang better * configure.ac: Clang now seems to have -Wformat-extra-args, -Wimplicit-const-int-float-conversion, and -Wtautological-constant-out-of-range-compare on by default, so disable them even if --enable-gcc-warnings is not used. Rely on Gnulib’s check for clang rather than rolling our own. --- diff --git a/configure.ac b/configure.ac index de57b32167..f239cd4791 100644 --- a/configure.ac +++ b/configure.ac @@ -172,6 +172,13 @@ AC_ARG_ENABLE([gcc-warnings], && gl_gcc_warnings=yes])] ) +# clang is unduly picky about some things, even by default. +if test "$gl_cv_compiler_clang" = yes; then + gl_WARN_ADD([-Wno-format-extra-args]) + gl_WARN_ADD([-Wno-implicit-const-int-float-conversion]) + gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) +fi + if test $gl_gcc_warnings != no; then gl_WARN_ADD([-Werror], [WERROR_CFLAGS]) AC_SUBST([WERROR_CFLAGS]) @@ -232,21 +239,6 @@ if test $gl_gcc_warnings != no; then gl_WARN_ADD([-Wno-unused-parameter]) # Too many warnings for now gl_WARN_ADD([-Wno-format-nonliteral]) - # clang is unduly picky about some things. - AC_CACHE_CHECK([whether the compiler is clang], [utils_cv_clang], - [AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[ - #ifndef __clang__ - #error "not clang" - #endif - ]])], - [utils_cv_clang=yes], - [utils_cv_clang=no])]) - if test $utils_cv_clang = yes; then - gl_WARN_ADD([-Wno-format-extra-args]) - gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare]) - fi - gl_WARN_ADD([-fdiagnostics-show-option]) gl_WARN_ADD([-funit-at-a-time])