1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-21 06:55:39 +00:00

Enable warnings when building as a developer with Clang

The configure-script logic that automatically enables warnings when
building in a development tree didn't work for Clang because it was
identified as an old GCC version.

* configure.ac: Don't test Clang version as if it were GCC.
This commit is contained in:
Mattias Engdegård 2022-04-08 14:57:17 +02:00
parent e2f3b0f16e
commit 13c8cc58bb

View File

@ -965,6 +965,17 @@ AC_DEFUN([gl_GCC_VERSION_IFELSE],
] ]
) )
# clang is unduly picky about some things.
AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#ifndef __clang__
error "not clang";
#endif
]])],
[emacs_cv_clang=yes],
[emacs_cv_clang=no])])
AC_ARG_ENABLE([gcc-warnings], AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@], [AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
[control generation of GCC warnings. The TYPE 'yes' [control generation of GCC warnings. The TYPE 'yes'
@ -984,7 +995,11 @@ AC_ARG_ENABLE([gcc-warnings],
# just a release imported into Git for patch management. # just a release imported into Git for patch management.
gl_gcc_warnings=no gl_gcc_warnings=no
if test -e "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then if test -e "$srcdir"/.git && test ! -f "$srcdir"/.tarball-version; then
gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only]) # Clang typically identifies itself as GCC 4.2 or something similar
# even if it is recent enough to accept the warnings we enable.
AS_IF([test "$emacs_cv_clang" = yes],
[gl_gcc_warnings=warn-only],
[gl_GCC_VERSION_IFELSE([5], [3], [gl_gcc_warnings=warn-only])])
fi]) fi])
AC_ARG_ENABLE([check-lisp-object-type], AC_ARG_ENABLE([check-lisp-object-type],
@ -996,17 +1011,6 @@ if test "$enable_check_lisp_object_type" = yes; then
[Define to enable compile-time checks for the Lisp_Object data type.]) [Define to enable compile-time checks for the Lisp_Object data type.])
fi fi
# clang is unduly picky about some things.
AC_CACHE_CHECK([whether the compiler is clang], [emacs_cv_clang],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[
#ifndef __clang__
error "not clang";
#endif
]])],
[emacs_cv_clang=yes],
[emacs_cv_clang=no])])
WERROR_CFLAGS= WERROR_CFLAGS=
# When compiling with GCC, prefer -isystem to -I when including system # When compiling with GCC, prefer -isystem to -I when including system
# include files, to avoid generating useless diagnostics for the files. # include files, to avoid generating useless diagnostics for the files.