summaryrefslogtreecommitdiffstats
path: root/src/vnet/interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet/interface.h')
-rw-r--r--src/vnet/interface.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/vnet/interface.h b/src/vnet/interface.h
index e9adfe84cbf..b34d19c55ef 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -108,6 +108,7 @@ typedef struct _vnet_interface_function_list_elt
clib_error_t *(*fp) (struct vnet_main_t * vnm, u32 if_index, u32 flags);
} _vnet_interface_function_list_elt_t;
+#ifndef CLIB_MARCH_VARIANT
#define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p) \
\
static void __vnet_interface_function_init_##tag##_##f (void) \
@@ -146,6 +147,12 @@ static void __vnet_interface_function_deinit_##tag##_##f (void) \
next = next->next_interface_function; \
} \
}
+#else
+/* create unused pointer to silence compiler warnings and get whole
+ function optimized out */
+#define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p) \
+static __clib_unused void * __clib_unused_##f = f;
+#endif
#define _VNET_INTERFACE_FUNCTION_DECL(f,tag) \
_VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,VNET_ITF_FUNC_PRIORITY_LOW)
@@ -248,6 +255,7 @@ typedef struct _vnet_device_class
vnet_interface_set_mac_address_function_t *mac_addr_change_function;
} vnet_device_class_t;
+#ifndef CLIB_MARCH_VARIANT
#define VNET_DEVICE_CLASS(x,...) \
__VA_ARGS__ vnet_device_class_t x; \
static void __vnet_add_device_class_registration_##x (void) \
@@ -267,6 +275,12 @@ static void __vnet_rm_device_class_registration_##x (void) \
&x, next_class_registration); \
} \
__VA_ARGS__ vnet_device_class_t x
+#else
+/* create unused pointer to silence compiler warnings and get whole
+ function optimized out */
+#define VNET_DEVICE_CLASS(x,...) \
+static __clib_unused vnet_device_class_t __clib_unused_##x
+#endif
#define VNET_DEVICE_CLASS_TX_FN(devclass) \
uword CLIB_MARCH_SFX (devclass##_tx_fn)(); \