DPDK patches and discussions
 help / color / mirror / Atom feed
From: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] fix rte_memcpy() macro: avoid unused value warning
Date: Mon, 15 Dec 2014 16:55:02 +0000	[thread overview]
Message-ID: <1418662502-16406-1-git-send-email-michalx.k.jastrzebski@intel.com> (raw)

From: Pawel Wodkowski <pawelx.wodkowski@intel.com>

This change use statements in expressions C extension provided by gcc to avoid
'value computed is not used' warning/error when size is not known at compile
time.

Comments on possible side effects are welcome an tests are welcome.

Reported-by: Qiu, Michael <michael.qiu@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
---
 .../common/include/arch/x86/rte_memcpy.h           |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
index 290c5cd..c3e8b81 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -169,9 +169,9 @@ rte_mov256(uint8_t *dst, const uint8_t *src)
 }
 
 #define rte_memcpy(dst, src, n)              \
-	((__builtin_constant_p(n)) ?          \
+	({ (__builtin_constant_p(n)) ?          \
 	memcpy((dst), (src), (n)) :          \
-	rte_memcpy_func((dst), (src), (n)))
+	rte_memcpy_func((dst), (src), (n)); })
 
 static inline void *
 rte_memcpy_func(void *dst, const void *src, size_t n)
-- 
1.7.9.5

             reply	other threads:[~2014-12-15 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15 16:55 Michal Jastrzebski [this message]
2014-12-16  1:57 ` Qiu, Michael
2014-12-16 23:50   ` Thomas Monjalon

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=1418662502-16406-1-git-send-email-michalx.k.jastrzebski@intel.com \
    --to=michalx.k.jastrzebski@intel.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).