summaryrefslogtreecommitdiffstats
path: root/src/vlib/node.h
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-08-10 22:39:11 +0200
committerDamjan Marion <dmarion@me.com>2018-08-13 14:33:54 +0000
commit6e36351faf5b69a0bfb8235b3b06f8b2c24e5547 (patch)
tree512c92bda1a48604fbfbc7bbbb1e4b613cdba614 /src/vlib/node.h
parent3bf6c2bfe59be62169a1245340722481b0b53870 (diff)
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 <damarion@cisco.com>
Diffstat (limited to 'src/vlib/node.h')
-rw-r--r--src/vlib/node.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/vlib/node.h b/src/vlib/node.h
index 67eaea3f0e8..277cee89caf 100644
--- a/src/vlib/node.h
+++ b/src/vlib/node.h
@@ -150,6 +150,7 @@ typedef struct _vlib_node_registration
} vlib_node_registration_t;
+#ifndef CLIB_MARCH_VARIANT
#define VLIB_REGISTER_NODE(x,...) \
__VA_ARGS__ vlib_node_registration_t x; \
static void __vlib_add_node_registration_##x (void) \
@@ -169,6 +170,10 @@ static void __vlib_rm_node_registration_##x (void) \
&x, next_registration); \
} \
__VA_ARGS__ vlib_node_registration_t x
+#else
+#define VLIB_REGISTER_NODE(x,...) \
+static __clib_unused vlib_node_registration_t __clib_unused_##x
+#endif
#define VLIB_NODE_FN(node) \
uword CLIB_MARCH_SFX (node##_fn)(); \