From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) by dpdk.org (Postfix) with ESMTP id D2FFF69D4 for ; Wed, 26 Apr 2017 14:07:50 +0200 (CEST) Received: by mail-wm0-f42.google.com with SMTP id u65so48250225wmu.1 for ; Wed, 26 Apr 2017 05:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1Le+OGKYDe+XrfmFCJAWTrqPpEbS23ZB75f+KkaMZDs=; b=WqmphnacByeqRaL9FiC35W6ynGtlESsCbAuFIfs/0spilhIZ3r5ZPPElj5YsF8kOwz GFq3cFbmeGK2pqocSryRZld45KGAor2qq3tj+QBMS7ujYVYXLDZXSbnNHbtS/KgeXWEf N077Jz22mKFPmnSiYvdWB58Fdy6NflrD1ssHY16zBA9U6+phS9Z8YPh3yInYRfNwm7EJ Py8TrElK68q2Ds/zlgyiTwU1JQz7xRenSDT8Eo8vbUY3hKs73HQwbvkgRUkOfpRbjr/t TQeptJs9p+0+gEinA6Z8KlEJ/xTpQfKKUq6nBCxhA2JUgpog4j40SdknoUBtAG6m3o+k lPhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1Le+OGKYDe+XrfmFCJAWTrqPpEbS23ZB75f+KkaMZDs=; b=oCUAE+MrbZE1gIEIfcXE6epyWRES1aim8DjEiG3cap6Tp08E6i0XhDKnP1Y4P/tUrJ 84hvffXcpm0R55GShGxOdS3D9H6433tmXgdTGnLqlud4p7yuwvnoo2t0sgUVnidba49I WAPnpq42ETS0FjRGiqnEI0C6ytsl5k9fMkI5pSsp0v9ZzoD9IYvr1tB7QBJIHBddO2GM b0UB7RWq72x7VAPESVMrVxmIyjAvesLftaodDnR4hcRaIY1sycfVnf++bzKxYHBv9Ir8 KQxO0b168PGejs6xjkPAlaqcn4sfaNUhykRxVhPW+KqAqS2Eck1+wtid/bmodeCaoh5z +a3Q== X-Gm-Message-State: AN3rC/6j6MMXz72YDjcSNLBzF0aw9i2sI+D08nKCQT2yG2CQaCdTGVBX dfvzvwibYMjUZtuiiR0= X-Received: by 10.28.47.23 with SMTP id v23mr608959wmv.50.1493208470356; Wed, 26 Apr 2017 05:07:50 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id 75sm8875680wmp.2.2017.04.26.05.07.49 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 26 Apr 2017 05:07:49 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Cc: stable@dpdk.org, Thomas Monjalon , Declan Doherty , Jerin Jacob Date: Wed, 26 Apr 2017 14:07:22 +0200 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v3 14/14] eal: fix debug macro redefinition X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 12:07:51 -0000 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 Cc: Declan Doherty Cc: Jerin Jacob Signed-off-by: Adrien Mazarguil --- 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 #include +#include #include __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