DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Neil Horman <nhorman@tuxdriver.com>
Subject: [dpdk-dev] [PATCH 20.05 10/15] replace used attributes
Date: Mon, 10 Feb 2020 17:20:27 +0100	[thread overview]
Message-ID: <20200210162032.1177478-11-thomas@monjalon.net> (raw)
In-Reply-To: <20200210162032.1177478-1-thomas@monjalon.net>

The new macro __rte_used, forcing symbol to be generated,
is now used where appropriate for consistency.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 lib/librte_eal/common/eal_common_options.c              | 2 +-
 lib/librte_eal/common/include/rte_common.h              | 5 +++++
 lib/librte_eal/common/include/rte_dev.h                 | 8 ++++----
 lib/librte_eal/common/include/rte_function_versioning.h | 2 +-
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index 5920233bcd..dcea9a3e9c 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -107,7 +107,7 @@ static const char *default_solib_dir = RTE_EAL_PMD_PATH;
  * Note: PLEASE DO NOT ALTER THIS without making a corresponding
  * change to usertools/dpdk-pmdinfo.py
  */
-static const char dpdk_solib_path[] __attribute__((used)) =
+static const char dpdk_solib_path[] __rte_used =
 "DPDK_PLUGIN_PATH=" RTE_EAL_PMD_PATH;
 
 TAILQ_HEAD(device_option_list, device_option);
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index fc66d9236a..1bd627fa9e 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -76,6 +76,11 @@ typedef uint16_t unaligned_uint16_t;
  */
 #define __rte_weak __attribute__((__weak__))
 
+/**
+ * Force symbol to be generated even if it appears to be unused.
+ */
+#define __rte_used __attribute__((used))
+
 /*********** Macros to eliminate unused variable warnings ********/
 
 /**
diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h
index a5c35f00c0..c8d985fb5c 100644
--- a/lib/librte_eal/common/include/rte_dev.h
+++ b/lib/librte_eal/common/include/rte_dev.h
@@ -205,17 +205,17 @@ typedef int (*rte_dev_cmp_t)(const struct rte_device *dev, const void *data);
 
 #define RTE_PMD_EXPORT_NAME(name, idx) \
 static const char RTE_PMD_EXPORT_NAME_ARRAY(this_pmd_name, idx) \
-__attribute__((used)) = RTE_STR(name)
+__rte_used = RTE_STR(name)
 
 #define DRV_EXP_TAG(name, tag) __##name##_##tag
 
 #define RTE_PMD_REGISTER_PCI_TABLE(name, table) \
-static const char DRV_EXP_TAG(name, pci_tbl_export)[] __attribute__((used)) = \
+static const char DRV_EXP_TAG(name, pci_tbl_export)[] __rte_used = \
 RTE_STR(table)
 
 #define RTE_PMD_REGISTER_PARAM_STRING(name, str) \
 static const char DRV_EXP_TAG(name, param_string_export)[] \
-__attribute__((used)) = str
+__rte_used = str
 
 /**
  * Advertise the list of kernel modules required to run this driver
@@ -240,7 +240,7 @@ __attribute__((used)) = str
  */
 #define RTE_PMD_REGISTER_KMOD_DEP(name, str) \
 static const char DRV_EXP_TAG(name, kmod_dep_export)[] \
-__attribute__((used)) = str
+__rte_used = str
 
 /**
  * Iteration context.
diff --git a/lib/librte_eal/common/include/rte_function_versioning.h b/lib/librte_eal/common/include/rte_function_versioning.h
index c924351d5e..b9f862d295 100644
--- a/lib/librte_eal/common/include/rte_function_versioning.h
+++ b/lib/librte_eal/common/include/rte_function_versioning.h
@@ -59,7 +59,7 @@
  * that it is being used as an implementation of a particular version of symbol
  * <b>.
  */
-#define __vsym __attribute__((used))
+#define __vsym __rte_used
 
 /*
  * MAP_STATIC_SYMBOL
-- 
2.25.0


  parent reply	other threads:[~2020-02-10 16:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-10 16:20 [dpdk-dev] [PATCH 20.05 00/15] clean-up use of __attribute__ Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 01/15] app/bbdev: replace constructor syntax with common macro Thomas Monjalon
2020-02-10 21:06   ` Chautru, Nicolas
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 02/15] net/mlx5: replace destructor " Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 03/15] net/memif: use common macros for cache line marker Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 04/15] common/mlx5: replace alignas keyword Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 05/15] replace alignment attributes Thomas Monjalon
2020-02-10 19:11   ` David Christensen
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 06/15] replace packed attributes Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 07/15] replace always-inline attributes Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 08/15] replace no-inline attributes Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 09/15] replace unused attributes Thomas Monjalon
2020-02-10 16:20 ` Thomas Monjalon [this message]
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 11/15] replace hot attributes Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 12/15] replace cold attributes Thomas Monjalon
2020-02-10 19:14   ` David Christensen
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 13/15] replace no-return attributes Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 14/15] replace printf format attributes Thomas Monjalon
2020-02-10 16:20 ` [dpdk-dev] [PATCH 20.05 15/15] devtools: check use of compiler attributes Thomas Monjalon
2020-04-16 16:34 ` [dpdk-dev] [PATCH 20.05 00/15] clean-up use of __attribute__ 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=20200210162032.1177478-11-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=dev@dpdk.org \
    --cc=nhorman@tuxdriver.com \
    /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).