All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
To: dev-VfR2kkLFssw@public.gmane.org
Subject: [dpdk-dev] [PATCH 14/22] lib: fix non-C99 macros definitions in exported headers
Date: Wed, 20 Mar 2013 17:05:02 +0100	[thread overview]
Message-ID: <7ce22ab34f1a997034f2aee12547acd78860ecea.1363795499.git.thomas.monjalon@6wind.com> (raw)
In-Reply-To: <cover.1363795499.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
In-Reply-To: <cover.1363795499.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

From: Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>

The original definitions prevent external programs/libraries from compiling
without warnings when using these headers and -std=gnu99 (relaxed C99 mode).

Acked-by: Ivan Boule <ivan.boule-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Acked-by: Damien Millescamps <damien.millescamps-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
---
 lib/librte_cmdline/cmdline_cirbuf.h       |    5 +++--
 lib/librte_eal/common/include/rte_debug.h |    3 ++-
 lib/librte_eal/common/include/rte_log.h   |   15 +++++++--------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/lib/librte_cmdline/cmdline_cirbuf.h b/lib/librte_cmdline/cmdline_cirbuf.h
index f934292..36b04ec 100644
--- a/lib/librte_cmdline/cmdline_cirbuf.h
+++ b/lib/librte_cmdline/cmdline_cirbuf.h
@@ -81,9 +81,10 @@ struct cirbuf {
 /* #define CIRBUF_DEBUG */
 
 #ifdef CIRBUF_DEBUG
-#define dprintf(fmt, ...) printf("line %3.3d - " fmt, __LINE__, ##__VA_ARGS__)
+#define dprintf_(fmt, ...) printf("line %3.3d - " fmt "%.0s", __LINE__, __VA_ARGS__)
+#define dprintf(...) dprintf_(__VA_ARGS__, "dummy")
 #else
-#define dprintf(args...) do {} while(0)
+#define dprintf(...) (void)0
 #endif
 
 
diff --git a/lib/librte_eal/common/include/rte_debug.h b/lib/librte_eal/common/include/rte_debug.h
index 451220e..1936dde 100644
--- a/lib/librte_eal/common/include/rte_debug.h
+++ b/lib/librte_eal/common/include/rte_debug.h
@@ -77,7 +77,8 @@ void rte_dump_registers(void);
  * @param args
  *   The variable list of arguments.
  */
-#define rte_panic(format, args...) __rte_panic(__func__, format, ## args)
+#define rte_panic_(func, format, ...) __rte_panic(func, format "%.0s", __VA_ARGS__)
+#define rte_panic(...) rte_panic_(__func__, __VA_ARGS__, "dummy")
 
 /*
  * Provide notification of a critical non-recoverable error and stop.
diff --git a/lib/librte_eal/common/include/rte_log.h b/lib/librte_eal/common/include/rte_log.h
index d361130..9a17730 100644
--- a/lib/librte_eal/common/include/rte_log.h
+++ b/lib/librte_eal/common/include/rte_log.h
@@ -274,14 +274,13 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap);
  *   - 0: Success.
  *   - Negative on error.
  */
-#define RTE_LOG(l, t, fmt, args...) ({					\
-	if ((RTE_LOG_##l <= RTE_LOG_LEVEL) &&				\
-	    (RTE_LOG_##l <= rte_logs.level) &&				\
-	    (RTE_LOGTYPE_##t & rte_logs.type)) {			\
-		rte_log(RTE_LOG_##l, RTE_LOGTYPE_##t,			\
-			  #t ": " fmt, ## args);			\
-	}								\
-})
+#define RTE_LOG(l, t, ...)					\
+	(((RTE_LOG_ ## l <= RTE_LOG_LEVEL) &&			\
+	  (RTE_LOG_ ## l <= rte_logs.level) &&			\
+	  (RTE_LOGTYPE_ ## t & rte_logs.type)) ?		\
+	 rte_log(RTE_LOG_ ## l,					\
+		 RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) :	\
+	 0)
 
 #ifdef __cplusplus
 }
-- 
1.7.2.5

  parent reply	other threads:[~2013-03-20 16:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-20 16:04 [dpdk-dev] [PATCH 00/22] upgrade with 6WIND's enhancements Thomas Monjalon
     [not found] ` <cover.1363795499.git.thomas.monjalon-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-03-20 16:04   ` [dpdk-dev] [PATCH 01/22] mk: use $CC to detect toolchain version Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 02/22] mk: fix typo in LDFLAGS for 32-bit Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 03/22] mk: fix verbose display of install command Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 04/22] mk: add a makefile for shared libraries Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 05/22] mk: allow corei7-avx flag with gcc 4.7 Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 06/22] app: fix volatile read for GCC >= 4.6 Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 07/22] app: fix unused values Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 08/22] app: use (void)variable when unused Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 09/22] app: fix testpmd compliance with __rte_mbuf_sanity_check() Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 10/22] app: fix config crash in testpmd Thomas Monjalon
2013-03-20 16:04   ` [dpdk-dev] [PATCH 11/22] app: fix autotest summary in error cases Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 12/22] lib: fix unused values Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 13/22] lib: fix uninitialized variables Thomas Monjalon
2013-03-20 16:05   ` Thomas Monjalon [this message]
2013-03-20 16:05   ` [dpdk-dev] [PATCH 15/22] mem: fix access to huge page with high address Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 16/22] timer: check TSC reliability Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 17/22] timer: get TSC frequency from /proc/cpuinfo Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 18/22] timer: option --vmware-tsc-map for VMware guest Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 19/22] pci: reference driver structure for each device Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 20/22] pci: allow drivers to be bound several times to the same PCI device Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 21/22] igb_uio: fix driver dependency Thomas Monjalon
2013-03-20 16:05   ` [dpdk-dev] [PATCH 22/22] igb_uio: fix build with kernel >= 3.8 Thomas Monjalon
2013-03-20 16:58   ` [dpdk-dev] [PATCH 00/22] upgrade with 6WIND's enhancements Vincent JARDIN
     [not found]     ` <5149EAD1.8070801-pdR9zngts4EAvxtiuMwx3w@public.gmane.org>
2013-03-21  9:40       ` 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=7ce22ab34f1a997034f2aee12547acd78860ecea.1363795499.git.thomas.monjalon@6wind.com \
    --to=thomas.monjalon-pdr9zngts4eavxtiumwx3w@public.gmane.org \
    --cc=dev-VfR2kkLFssw@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.