From: Ethan Jackson Date: Tue, 13 Sep 2011 20:15:48 +0000 (-0700) Subject: lib: Suppress comparison warnings in ovsdb libraries. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a6d214f0055dc773750295a5db7cc5ca14bc5ce7;p=openvswitch lib: Suppress comparison warnings in ovsdb libraries. This patch fixes compiler warnings like the following: ./lib/ovsdb-types.h:171:5: error: comparison of unsigned expression >= 0 is always true [-Werror=type-limits] --- diff --git a/lib/ovsdb-parser.c b/lib/ovsdb-parser.c index e1832a99..c46c237e 100644 --- a/lib/ovsdb-parser.c +++ b/lib/ovsdb-parser.c @@ -80,7 +80,7 @@ ovsdb_parser_member(struct ovsdb_parser *parser, const char *name, return NULL; } - if ((value->type >= 0 && value->type < JSON_N_TYPES + if (((int) value->type >= 0 && value->type < JSON_N_TYPES && types & (1u << value->type)) || (types & OP_ID && value->type == JSON_STRING && ovsdb_parser_is_id(value->u.string))) diff --git a/lib/ovsdb-types.h b/lib/ovsdb-types.h index e852391c..a7b4e208 100644 --- a/lib/ovsdb-types.h +++ b/lib/ovsdb-types.h @@ -168,7 +168,7 @@ struct json *ovsdb_type_to_json(const struct ovsdb_type *); static inline bool ovsdb_atomic_type_is_valid(enum ovsdb_atomic_type atomic_type) { - return atomic_type >= 0 && atomic_type < OVSDB_N_TYPES; + return (int) atomic_type >= 0 && atomic_type < OVSDB_N_TYPES; } static inline bool