use appropriate EAL macro for constructors
authorJerin Jacob <jerinj@marvell.com>
Mon, 18 Mar 2019 04:15:56 +0000 (04:15 +0000)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 27 Mar 2019 22:10:57 +0000 (23:10 +0100)
Use eal's RTE_INIT abstraction for defining constructors.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
app/test-bbdev/main.h
app/test/resource.h
app/test/test.h
lib/librte_mempool/rte_mempool.h

index 20a55ef..2bbe1b8 100644 (file)
@@ -103,8 +103,7 @@ void add_test_command(struct test_command *t);
                .command = RTE_STR(name), \
                .callback = test_func_##name, \
        }; \
-       static void __attribute__((constructor, used)) \
-       test_register_##name(void) \
+       RTE_INIT(test_register_##name) \
        { \
                add_test_command(&test_struct_##name); \
        }
index 223fa22..c75ebd4 100644 (file)
@@ -98,7 +98,7 @@ static struct resource linkres_ ##n = {       \
        .begin = b,             \
        .end = e,               \
 };                              \
-static void __attribute__((constructor, used)) resinitfn_ ##n(void) \
+RTE_INIT(resinitfn_ ##n)       \
 {                               \
        resource_register(&linkres_ ##n);  \
 }
index 7c24432..9b3846b 100644 (file)
@@ -177,8 +177,7 @@ void add_test_command(struct test_command *t);
                .command = RTE_STR(cmd), \
                .callback = func, \
        }; \
-       static void __attribute__((constructor, used)) \
-       test_register_##cmd(void) \
+       RTE_INIT(test_register_##cmd) \
        { \
                add_test_command(&test_struct_##cmd); \
        }
index 7c9cd9a..fd19470 100644 (file)
@@ -832,10 +832,9 @@ int rte_mempool_register_ops(const struct rte_mempool_ops *ops);
  * Note that the rte_mempool_register_ops fails silently here when
  * more than RTE_MEMPOOL_MAX_OPS_IDX is registered.
  */
-#define MEMPOOL_REGISTER_OPS(ops)                                      \
-       void mp_hdlr_init_##ops(void);                                  \
-       void __attribute__((constructor, used)) mp_hdlr_init_##ops(void)\
-       {                                                               \
+#define MEMPOOL_REGISTER_OPS(ops)                              \
+       RTE_INIT(mp_hdlr_init_##ops)                            \
+       {                                                       \
                rte_mempool_register_ops(&ops);                 \
        }