All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Thomas Monjalon <thomas@monjalon.net>,
	Declan Doherty <declan.doherty@intel.com>,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>
Subject: [PATCH v3 14/14] eal: fix debug macro redefinition
Date: Wed, 26 Apr 2017 14:07:22 +0200	[thread overview]
Message-ID: <a5aecdc2d1e9e43c32fab748cf1196dbfb65efe7.1493208189.git.adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <cover.1493208189.git.adrien.mazarguil@6wind.com>

The RTE_FUNC_*_RET() and RTE_PROC_*_RET() macro definitions in rte_dev.h
require RTE_PMD_DEBUG_TRACE(). This macro is defined as needed by users of
rte_dev.h since its value depends on their own debug settings.

It may be defined multiple times as a result when including files from
various components simultaneously. Worse, these redefinitions may be
inconsistent. This causes the following compilation errors:

 In file included from /tmp/check-includes.sh.13890.c:27:0:
    build/include/rte_eventdev_pmd.h:58:0: error: "RTE_PMD_DEBUG_TRACE"
    redefined [-Werror]
 [...]
 In file included from build/include/rte_ethdev_pci.h:39:0,
                  from /tmp/check-includes.sh.13890.c:13:
    build/include/rte_ethdev.h:1042:0: note: this is the location of the
    previous definition
 [...]
 In file included from /tmp/check-includes.sh.13890.c:83:0:
    build/include/rte_cryptodev_pmd.h:65:0: error: "RTE_PMD_DEBUG_TRACE"
    redefined [-Werror]
 [...]
 In file included from /tmp/check-includes.sh.13890.c:27:0:
    build/include/rte_eventdev_pmd.h:58:0: note: this is the location of
    the previous definition
 [...]

This commit moves the RTE_PMD_DEBUG_TRACE() definition to rte_dev.h where
it is enabled consistently depending on global configuration settings and
removes redundant definitions.

Also when disabled, RTE_PMD_DEBUG_TRACE() is now defined as (void)0 to
avoid empty statements warnings if used outside { } blocks.

Fixes: b974e4a40cb5 ("ethdev: make error checking macros public")

Cc: stable@dpdk.org
Cc: Thomas Monjalon <thomas@monjalon.net>
Cc: Declan Doherty <declan.doherty@intel.com>
Cc: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 lib/librte_cryptodev/rte_cryptodev_pmd.h |  8 --------
 lib/librte_eal/common/include/rte_dev.h  | 14 ++++++++++++++
 lib/librte_ether/rte_ethdev.h            |  9 ---------
 lib/librte_eventdev/rte_eventdev_pmd.h   |  7 -------
 4 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 356b9dc..17ef37c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -57,14 +57,6 @@ extern "C" {
 #include "rte_crypto.h"
 #include "rte_cryptodev.h"
 
-
-#ifdef RTE_LIBRTE_CRYPTODEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
 struct rte_cryptodev_session {
 	RTE_STD_C11
 	struct {
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index 67c2b0c..d18e6b8 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -49,6 +49,7 @@ extern "C" {
 #include <stdio.h>
 #include <sys/queue.h>
 
+#include <rte_config.h>
 #include <rte_log.h>
 
 __attribute__((format(printf, 2, 0)))
@@ -70,6 +71,19 @@ rte_pmd_debug_trace(const char *func_name, const char *fmt, ...)
 	rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, "%s: %s", func_name, buffer);
 }
 
+/*
+ * Enable RTE_PMD_DEBUG_TRACE() when at least one component relying on the
+ * RTE_*_RET() macros defined below is compiled in debug mode.
+ */
+#if defined(RTE_LIBRTE_ETHDEV_DEBUG) || \
+	defined(RTE_LIBRTE_CRYPTODEV_DEBUG) || \
+	defined(RTE_LIBRTE_EVENTDEV_DEBUG)
+#define RTE_PMD_DEBUG_TRACE(...) \
+	rte_pmd_debug_trace(__func__, __VA_ARGS__)
+#else
+#define RTE_PMD_DEBUG_TRACE(...) (void)0
+#endif
+
 /* Macros for checking for restricting functions to primary instance only */
 #define RTE_PROC_PRIMARY_OR_ERR_RET(retval) do { \
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY) { \
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index e0f7ee5..5f1d663 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1034,15 +1034,6 @@ struct rte_eth_dev_callback;
 /** @internal Structure to keep track of registered callbacks */
 TAILQ_HEAD(rte_eth_dev_cb_list, rte_eth_dev_callback);
 
-
-#ifdef RTE_LIBRTE_ETHDEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
-
 /* Macros to check for valid port */
 #define RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, retval) do { \
 	if (!rte_eth_dev_is_valid_port(port_id)) { \
diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h
index 988018f..4005b3c 100644
--- a/lib/librte_eventdev/rte_eventdev_pmd.h
+++ b/lib/librte_eventdev/rte_eventdev_pmd.h
@@ -54,13 +54,6 @@ extern "C" {
 
 #include "rte_eventdev.h"
 
-#ifdef RTE_LIBRTE_EVENTDEV_DEBUG
-#define RTE_PMD_DEBUG_TRACE(...) \
-	rte_pmd_debug_trace(__func__, __VA_ARGS__)
-#else
-#define RTE_PMD_DEBUG_TRACE(...)
-#endif
-
 /* Logging Macros */
 #define RTE_EDEV_LOG_ERR(...) \
 	RTE_LOG(ERR, EVENTDEV, \
-- 
2.1.4

  parent reply	other threads:[~2017-04-26 12:07 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-24 15:52 [PATCH 00/13] Fixes for exported headers Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 01/13] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 02/13] eventdev: fix errors with strict compilation flags Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 03/13] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 04/13] net: fix missing include " Adrien Mazarguil
2017-04-24 15:52 ` [PATCH 05/13] vhost: fix errors with strict compilation flags Adrien Mazarguil
2017-04-25  2:15   ` Yuanhan Liu
2017-04-26  7:32   ` Maxime Coquelin
2017-04-24 15:53 ` [PATCH 06/13] mbuf: fix missing includes in exported header Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 07/13] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-24 16:19   ` Legacy, Allain
2017-04-24 15:53 ` [PATCH 08/13] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 09/13] efd: fix missing include " Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 10/13] metrics: fix errors " Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 11/13] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-24 15:53 ` [PATCH 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE) Adrien Mazarguil
2017-04-25  1:18   ` Xing, Beilei
2017-04-24 15:53 ` [PATCH 13/13] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-25  8:29 ` [PATCH v2 00/13] Fixes for exported headers Adrien Mazarguil
2017-04-25  8:29   ` [PATCH v2 01/13] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-25 15:38     ` Zhang, Roy Fan
2017-04-25  8:29   ` [PATCH v2 02/13] eventdev: fix errors with strict compilation flags Adrien Mazarguil
2017-04-25 15:31     ` De Lara Guarch, Pablo
2017-04-26  7:06       ` Adrien Mazarguil
2017-04-25  8:29   ` [PATCH v2 03/13] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-25  8:29   ` [PATCH v2 04/13] net: fix missing include " Adrien Mazarguil
2017-04-25 16:13     ` Singh, Jasvinder
2017-04-25  8:29   ` [PATCH v2 05/13] vhost: fix errors with strict compilation flags Adrien Mazarguil
2017-04-25  8:30   ` [PATCH v2 06/13] mbuf: fix missing includes in exported header Adrien Mazarguil
2017-04-25  9:56     ` Olivier Matz
2017-04-25  8:30   ` [PATCH v2 07/13] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-25 12:31     ` Legacy, Allain
2017-04-25 12:49       ` Adrien Mazarguil
2017-04-25 13:00         ` Legacy, Allain
2017-04-25 14:48           ` Adrien Mazarguil
2017-04-25 14:54             ` Legacy, Allain
2017-04-25  8:30   ` [PATCH v2 08/13] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-25  8:30   ` [PATCH v2 09/13] efd: fix missing include " Adrien Mazarguil
2017-04-25  8:30   ` [PATCH v2 10/13] metrics: fix errors " Adrien Mazarguil
2017-04-25  8:30   ` [PATCH v2 11/13] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-25 11:35     ` [dpdk-stable] " Shahaf Shuler
2017-04-25  8:30   ` [PATCH v2 12/13] ethdev: fix C++ errors in flow API (MPLS, GRE) Adrien Mazarguil
2017-04-25 11:37     ` Shahaf Shuler
2017-04-25  8:30   ` [PATCH v2 13/13] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-25 10:04   ` [PATCH v2 00/13] Fixes for exported headers Ferruh Yigit
2017-04-26 12:07   ` [PATCH v3 00/14] " Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 01/14] crypto/scheduler: fix missing includes Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 02/14] eventdev: fix errors with strict compilation flags Adrien Mazarguil
2017-04-26 14:47       ` Jerin Jacob
2017-04-26 12:07     ` [PATCH v3 03/14] latency: fix missing includes in exported header Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 04/14] net: fix missing include " Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 05/14] vhost: fix errors with strict compilation flags Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 06/14] mbuf: fix missing includes in exported header Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 07/14] net/avp: fix errors in exported headers Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 08/14] bitrate: fix errors in exported header Adrien Mazarguil
2017-04-26 15:07       ` Remy Horton
2017-04-26 12:07     ` [PATCH v3 09/14] efd: fix missing include " Adrien Mazarguil
2017-04-26 15:36       ` De Lara Guarch, Pablo
2017-04-26 12:07     ` [PATCH v3 10/14] metrics: fix errors " Adrien Mazarguil
2017-04-26 15:07       ` Remy Horton
2017-04-26 12:07     ` [PATCH v3 11/14] ethdev: fix C++ errors in flow API Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 12/14] ethdev: fix C++ errors in flow API (MPLS, GRE) Adrien Mazarguil
2017-04-26 12:07     ` [PATCH v3 13/14] ethdev: fix incomplete items in flow API Adrien Mazarguil
2017-04-27  1:03       ` Lu, Wenzhuo
2017-04-26 12:07     ` Adrien Mazarguil [this message]
2017-04-30 22:13     ` [PATCH v3 00/14] Fixes for exported headers 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=a5aecdc2d1e9e43c32fab748cf1196dbfb65efe7.1493208189.git.adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=declan.doherty@intel.com \
    --cc=dev@dpdk.org \
    --cc=jerin.jacob@caviumnetworks.com \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /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.