Reduces binary size. Use a static inline function instead of
a macro to not get "unused variable" warning everywhere.

Signed-off-by: Helmut Schaa <helmut.sc...@googlemail.com>
---

Not sure if this is the best idea but in my builds it reduces libopenvswitch
by around 10%.

Thoughts?

Thanks,
Helmut

 lib/util.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/util.h b/lib/util.h
index 0327ab0..b5ab0a2 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -69,10 +69,15 @@
  *   - Writes the failure message to the log.
  *
  *   - Not affected by NDEBUG. */
+#ifndef NDEBUG
 #define ovs_assert(CONDITION)                                           \
     if (!OVS_LIKELY(CONDITION)) {                                       \
         ovs_assert_failure(SOURCE_LOCATOR, __func__, #CONDITION);       \
     }
+#else
+static inline void ovs_assert(bool cond OVS_UNUSED) {}
+#endif
+
 void ovs_assert_failure(const char *, const char *, const char *) NO_RETURN;
 
 /* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes
-- 
1.8.1.4

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to