summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2013-09-23 09:12:01 +0200
committerJan Djärv <jan.h.d@swipnet.se>2013-09-23 09:12:01 +0200
commit8762e52438d46d81e518179e4f9bd8a939463ddb (patch)
tree33a25414302599a9dbe3d2a4144927e128f57af1 /configure.ac
parent332153538c3268edb9154fbe29a6fdc5e012e595 (diff)
downloademacs-8762e52438d46d81e518179e4f9bd8a939463ddb.tar.gz
Suppress some unhelpful warnings when using clang.
* configure.ac: With clang, check for and use -Wno-switch, -Wno-tautological-constant-out-of-range-compare and -Wno-pointer-sign. * conf_post.h(assume): Use __builtin_unreachable for clang. * src/filelock.c (lock_file_1): Rearrange to remove compiler warning about excess arguments to snprintf.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac28
1 files changed, 18 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac
index c63627d18d4..16259f01ed2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -787,10 +787,28 @@ 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])])
+
# When compiling with GCC, prefer -isystem to -I when including system
# include files, to avoid generating useless diagnostics for the files.
if test "$gl_gcc_warnings" != yes; then
isystem='-I'
+ if test "$emacs_cv_clang" = yes
+ then
+ # Turn off some warnings if supported.
+ gl_WARN_ADD([-Wno-switch])
+ gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
+ gl_WARN_ADD([-Wno-pointer-sign])
+ fi
else
isystem='-isystem '
@@ -840,16 +858,6 @@ else
nw="$nw -Wtype-limits"
nw="$nw -Wunused-parameter"
- # 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])])
if test $emacs_cv_clang = yes; then
nw="$nw -Wcast-align"
fi