loci: fix non-generated unused variable warnings
diff --git a/c_gen/c_code_gen.py b/c_gen/c_code_gen.py
index 4aec103..735dc6d 100644
--- a/c_gen/c_code_gen.py
+++ b/c_gen/c_code_gen.py
@@ -1108,8 +1108,10 @@
static inline void
of_object_parent_length_update(of_object_t *obj, int delta)
{
+#ifndef NDEBUG
int count = 0;
of_wire_buffer_t *wbuf; /* For debug asserts only */
+#endif
while (obj != NULL) {
ASSERT(count++ < _MAX_PARENT_ITERATIONS);
@@ -1117,7 +1119,9 @@
if (obj->wire_length_set != NULL) {
obj->wire_length_set(obj, obj->length);
}
+#ifndef NDEBUG
wbuf = obj->wire_object.wbuf;
+#endif
/* Asserts for wire length checking */
ASSERT(obj->length + obj->wire_object.obj_offset <=
diff --git a/c_gen/templates/of_type_maps.c b/c_gen/templates/of_type_maps.c
index ef1df37..f1fab57 100644
--- a/c_gen/templates/of_type_maps.c
+++ b/c_gen/templates/of_type_maps.c
@@ -50,8 +50,7 @@
void
of_object_message_wire_length_get(of_object_t *obj, int *bytes)
{
- of_wire_buffer_t *wbuf = OF_OBJECT_TO_WBUF(obj);
- ASSERT(wbuf != NULL);
+ ASSERT(OF_OBJECT_TO_WBUF(obj) != NULL);
// ASSERT(obj is message)
*bytes = of_message_length_get(OF_OBJECT_TO_MESSAGE(obj));
}
@@ -65,9 +64,7 @@
void
of_object_message_wire_length_set(of_object_t *obj, int bytes)
{
- of_wire_buffer_t *wbuf = OF_OBJECT_TO_WBUF(obj);
- ASSERT(wbuf != NULL);
-
+ ASSERT(OF_OBJECT_TO_WBUF(obj) != NULL);
// ASSERT(obj is message)
of_message_length_set(OF_OBJECT_TO_MESSAGE(obj), bytes);
}