From acff07caf1bee9917ab19383b3716f9c6f1af6c2 Mon Sep 17 00:00:00 2001 From: Tomas Krizek Date: Fri, 2 Oct 2020 10:23:40 +0200 Subject: [PATCH] clang: silence useless warning in lib/layer.h This silences the following warning, which frequently appears in Travis CI. ./lib/layer.h:51:21: warning: result of comparison of constant 32 with expression of type 'enum kr_layer_state' is always true [-Wtautological-constant-out-of-range-compare] return s >= 0 && s < (1 << 5); ~ ^ ~~~~~~~~ --- lib/layer.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/layer.h b/lib/layer.h index 2a1328997..98d611c81 100644 --- a/lib/layer.h +++ b/lib/layer.h @@ -48,7 +48,14 @@ enum kr_layer_state { /** Check that a kr_layer_state makes sense. We're not very strict ATM. */ static inline bool kr_state_consistent(enum kr_layer_state s) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare" +#endif return s >= 0 && s < (1 << 5); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif } /* Forward declarations. */ -- 2.47.2