[ovs-dev] [warnings 1/4] lib: Suppress comparison warnings in ovsdb libraries.

Ethan Jackson ethan at nicira.com
Tue Sep 13 14:31:50 PDT 2011


Here's another version.  It simply silences the warnings.

---
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]
---
 lib/ovsdb-parser.c |    2 +-
 lib/ovsdb-types.h  |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ovsdb-parser.c b/lib/ovsdb-parser.c
index e1832a9..c46c237 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 e852391..a7b4e20 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
-- 
1.7.6.1




More information about the dev mailing list