Change in ...libosmocore[master]: utils.h: fix warning "empty expression

lynxis lazus gerrit-no-reply at lists.osmocom.org
Sat Jun 22 23:56:03 UTC 2019


lynxis lazus has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/14578


Change subject: utils.h: fix warning "empty expression
......................................................................

utils.h: fix warning "empty expression

When using `OSMO_ASSERT(exp);` clang will warn about
an empty expression, because the semi colon was superflous.
Use do {} while (0) to circum vent.

Change-Id: I2272d29a81496164bebd1696a694383a28a86434
---
M include/osmocom/core/utils.h
1 file changed, 2 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/78/14578/1

diff --git a/include/osmocom/core/utils.h b/include/osmocom/core/utils.h
index 601bb56..8585a6a 100644
--- a/include/osmocom/core/utils.h
+++ b/include/osmocom/core/utils.h
@@ -98,9 +98,9 @@
  *  the predicate evaluates to false (0).
  */
 #define OSMO_ASSERT(exp)    \
-	if (!(exp)) { \
+	do if (!(exp)) { \
 		osmo_panic("Assert failed %s %s:%d\n", #exp, __FILE__, __LINE__); \
-	}
+	} while(0)
 
 /*! duplicate a string using talloc and release its prior content (if any)
  * \param[in] ctx Talloc context to use for allocation

-- 
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/14578
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I2272d29a81496164bebd1696a694383a28a86434
Gerrit-Change-Number: 14578
Gerrit-PatchSet: 1
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190622/c4b055e3/attachment.html>


More information about the gerrit-log mailing list