[20.05,10/15] replace used attributes
diff mbox series

Message ID 20200210162032.1177478-11-thomas@monjalon.net
State Accepted, archived
Delegated to: David Marchand
Headers show
Series
  • clean-up use of __attribute__
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon Feb. 10, 2020, 4:20 p.m. UTC
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(-)

Patch
diff mbox series

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