You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
1.1 KiB

  1. From 34b51e26555d05c00b2320f943a645added5dae4 Mon Sep 17 00:00:00 2001
  2. From: Helmut Schaa <helmut.schaa@googlemail.com>
  3. Date: Mon, 9 Dec 2013 14:15:11 +0100
  4. Subject: [PATCH 5/6] lib/util.h: Disable ovs_assert when build with NDEBUG
  5. Reduces binary size. Use a static inline function instead of
  6. a macro to not get "unused variable" warning everywhere.
  7. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
  8. ---
  9. lib/util.h | 5 +++++
  10. 1 file changed, 5 insertions(+)
  11. diff --git a/lib/util.h b/lib/util.h
  12. index 5c23962..9e5866d 100644
  13. --- a/lib/util.h
  14. +++ b/lib/util.h
  15. @@ -69,10 +69,15 @@
  16. * - Writes the failure message to the log.
  17. *
  18. * - Not affected by NDEBUG. */
  19. +#ifndef NDEBUG
  20. #define ovs_assert(CONDITION) \
  21. if (!OVS_LIKELY(CONDITION)) { \
  22. ovs_assert_failure(SOURCE_LOCATOR, __func__, #CONDITION); \
  23. }
  24. +#else
  25. +static inline void ovs_assert(bool cond OVS_UNUSED) {}
  26. +#endif
  27. +
  28. void ovs_assert_failure(const char *, const char *, const char *) NO_RETURN;
  29. /* Casts 'pointer' to 'type' and issues a compiler warning if the cast changes
  30. --
  31. 1.8.1.4