[PATCH iproute2 1/3] json_print: fix Gcc-17 warnings

Stephen Hemminger <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <[email protected]>
Lastest version of Gcc and Clang warn about value of 2 in
logical operator. Example:
 warning: use of logical ‘&&’ with constant operand ‘2’ [-Wconstant-logical-operand]

Signed-off-by: Stephen Hemminger <[email protected]>
---
 include/json_print.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/json_print.h b/include/json_print.h
index 6a458189..79d8d4ff 100644
--- a/include/json_print.h
+++ b/include/json_print.h
@@ -15,8 +15,8 @@
 #include "json_writer.h"
 #include "color.h"
 
-#define _IS_JSON_CONTEXT(type) (is_json_context() && (type & PRINT_JSON || type & PRINT_ANY))
-#define _IS_FP_CONTEXT(type)   (!is_json_context() && (type & PRINT_FP || type & PRINT_ANY))
+#define _IS_JSON_CONTEXT(type) (is_json_context() && !!((type) & (PRINT_JSON | PRINT_ANY)))
+#define _IS_FP_CONTEXT(type)   (!is_json_context() && !!((type) & (PRINT_FP | PRINT_ANY)))
 
 json_writer_t *get_json_writer(void);
 
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.