]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
clang: silence useless warning in lib/layer.h
authorTomas Krizek <tomas.krizek@nic.cz>
Fri, 2 Oct 2020 08:23:40 +0000 (10:23 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Fri, 2 Oct 2020 08:48:51 +0000 (10:48 +0200)
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

index 2a1328997404503079ab4c9aea6535dfc228e385..98d611c81ec30e10031adc18049c3edf14f02fe9 100644 (file)
@@ -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. */