DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ilya Matveychikov <matvejchikov@gmail.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] debug: update assertion macro
Date: Sun, 19 Nov 2017 12:18:49 +0400	[thread overview]
Message-ID: <9B0F484B-2803-4882-B324-8E4B1AFEFAF2@gmail.com> (raw)

Update RTE_VERIFY macro to make it possible to use complex expressions
in RTE_ASSERT.

Signed-off-by: Ilya V. Matveychikov <matvejchikov@gmail.com>

Fixes: 148f963fb532 ("xen: core library changes")
Cc: bruce.richardson@intel.com

---
Now it's incorrect to use complex expressions for assertion
like RTE_ASSERT((1 + 2) == 3). This patch makes it possible.

 lib/librte_eal/common/include/rte_debug.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/include/rte_debug.h b/lib/librte_eal/common/include/rte_debug.h
index 79b67b3ec..fbb3bb5e5 100644
--- a/lib/librte_eal/common/include/rte_debug.h
+++ b/lib/librte_eal/common/include/rte_debug.h
@@ -86,7 +86,7 @@ void rte_dump_registers(void);
 #endif
 #define	RTE_VERIFY(exp)	do {                                                  \
 	if (unlikely(!(exp)))                                                           \
-		rte_panic("line %d\tassert \"" #exp "\" failed\n", __LINE__); \
+		rte_panic("line %d\tassert \"%s\" failed\n", __LINE__, #exp); \
 } while (0)

 /*
--
2.15.0

             reply	other threads:[~2017-11-19  8:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-19  8:18 Ilya Matveychikov [this message]
2017-11-19 14:41 ` Ilya Matveychikov
2017-12-15 19:56   ` Ferruh Yigit
2017-12-22  2:12     ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9B0F484B-2803-4882-B324-8E4B1AFEFAF2@gmail.com \
    --to=matvejchikov@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).