summaryrefslogtreecommitdiff
path: root/src/conf_post.h
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 /src/conf_post.h
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 'src/conf_post.h')
-rw-r--r--src/conf_post.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/conf_post.h b/src/conf_post.h
index 14af38ce70b..7d4e1f43ed7 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -248,12 +248,20 @@ extern void _DebPrint (const char *fmt, ...);
# define FLEXIBLE_ARRAY_MEMBER 1
#endif
+#ifdef __clang__
+# ifndef __has_builtin
+# define __has_builtin(x) 0
+# endif
+#endif
+
/* assume(cond) tells the compiler (and lint) that a certain condition
* will always hold, and that it should optimize (or check) accordingly. */
#if defined lint
# define assume(cond) ((cond) ? (void) 0 : abort ())
#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || __GNUC__ > 4
# define assume(cond) ((cond) || (__builtin_unreachable(), 0))
+#elif defined (__clang__) && __has_builtin (__builtin_unreachable)
+# define assume(cond) ((cond) || (__builtin_unreachable(), 0))
#elif defined __MSC_VER
# define assume(cond) __assume ((cond))
#else