From 6e36351faf5b69a0bfb8235b3b06f8b2c24e5547 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Fri, 10 Aug 2018 22:39:11 +0200 Subject: Multiarch handling in different constructor macros This significantly reduces need for ... in multiarch code. Simply constructor macros will jost create static unused entry if CLIB_MARCH_VARIANT is defined and that will be optimized out by compiler. Change-Id: I17d1c4ac0c903adcfadaa4a07de1b854c7ab14ac Signed-off-by: Damjan Marion --- src/vnet/feature/feature.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/vnet/feature') diff --git a/src/vnet/feature/feature.h b/src/vnet/feature/feature.h index 88a919f083a..eb9b7b06243 100644 --- a/src/vnet/feature/feature.h +++ b/src/vnet/feature/feature.h @@ -99,6 +99,7 @@ typedef struct extern vnet_feature_main_t feature_main; +#ifndef CLIB_MARCH_VARIANT #define VNET_FEATURE_ARC_INIT(x,...) \ __VA_ARGS__ vnet_feature_arc_registration_t vnet_feat_arc_##x;\ static void __vnet_add_feature_arc_registration_##x (void) \ @@ -138,6 +139,14 @@ static void __vnet_rm_feature_registration_##x (void) \ VLIB_REMOVE_FROM_LINKED_LIST (fm->next_feature, r, next); \ } \ __VA_ARGS__ vnet_feature_registration_t vnet_feat_##x +#else +#define VNET_FEATURE_ARC_INIT(x,...) \ +extern vnet_feature_arc_registration_t __clib_unused vnet_feat_arc_##x; \ +static vnet_feature_arc_registration_t __clib_unused __clib_unused_vnet_feat_arc_##x +#define VNET_FEATURE_INIT(x,...) \ +extern vnet_feature_registration_t __clib_unused vnet_feat_##x; \ +static vnet_feature_registration_t __clib_unused __clib_unused_vnet_feat_##x +#endif void vnet_config_update_feature_count (vnet_feature_main_t * fm, u8 arc, -- cgit 1.2.3-korg