clang does not allow attribute declarations after definitions: flowtable.c:41:1: warning: attribute declaration must precede definition [-Wignored-attributes] EXPORT_SYMBOL(nftnl_flowtable_alloc); ^ ../include/utils.h:13:41: note: expanded from macro 'EXPORT_SYMBOL' # define EXPORT_SYMBOL(x) typeof(x) (x) __visible; ^ ../include/utils.h:12:35: note: expanded from macro '__visible' # define __visible __attribute__((visibility("default"))) ^ flowtable.c:37:25: note: previous definition is here struct nftnl_flowtable *nftnl_flowtable_alloc(void) Move attribute declarations before the symbol definitions just like it's done in other source files Signed-off-by: Marvin Schmidt <marvin_schmidt@xxxxxxx> --- :100644 100644 020f102 f9101e8 M src/flowtable.c src/flowtable.c | 54 ++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/flowtable.c b/src/flowtable.c index 020f102..f9101e8 100644 --- a/src/flowtable.c +++ b/src/flowtable.c @@ -34,12 +34,13 @@ struct nftnl_flowtable { uint32_t flags; }; +EXPORT_SYMBOL(nftnl_flowtable_alloc); struct nftnl_flowtable *nftnl_flowtable_alloc(void) { return calloc(1, sizeof(struct nftnl_flowtable)); } -EXPORT_SYMBOL(nftnl_flowtable_alloc); +EXPORT_SYMBOL(nftnl_flowtable_free); void nftnl_flowtable_free(const struct nftnl_flowtable *c) { int i; @@ -56,14 +57,14 @@ void nftnl_flowtable_free(const struct nftnl_flowtable *c) } xfree(c); } -EXPORT_SYMBOL(nftnl_flowtable_free); +EXPORT_SYMBOL(nftnl_flowtable_is_set); bool nftnl_flowtable_is_set(const struct nftnl_flowtable *c, uint16_t attr) { return c->flags & (1 << attr); } -EXPORT_SYMBOL(nftnl_flowtable_is_set); +EXPORT_SYMBOL(nftnl_flowtable_unset); void nftnl_flowtable_unset(struct nftnl_flowtable *c, uint16_t attr) { int i; @@ -95,7 +96,6 @@ void nftnl_flowtable_unset(struct nftnl_flowtable *c, uint16_t attr) c->flags &= ~(1 << attr); } -EXPORT_SYMBOL(nftnl_flowtable_unset); static uint32_t nftnl_flowtable_validate[NFTNL_FLOWTABLE_MAX + 1] = { [NFTNL_FLOWTABLE_HOOKNUM] = sizeof(uint32_t), @@ -104,6 +104,7 @@ static uint32_t nftnl_flowtable_validate[NFTNL_FLOWTABLE_MAX + 1] = { [NFTNL_FLOWTABLE_FLAGS] = sizeof(uint32_t), }; +EXPORT_SYMBOL(nftnl_flowtable_set_data); int nftnl_flowtable_set_data(struct nftnl_flowtable *c, uint16_t attr, const void *data, uint32_t data_len) { @@ -169,32 +170,32 @@ int nftnl_flowtable_set_data(struct nftnl_flowtable *c, uint16_t attr, c->flags |= (1 << attr); return 0; } -EXPORT_SYMBOL(nftnl_flowtable_set_data); +EXPORT_SYMBOL(nftnl_flowtable_set); void nftnl_flowtable_set(struct nftnl_flowtable *c, uint16_t attr, const void *data) { nftnl_flowtable_set_data(c, attr, data, nftnl_flowtable_validate[attr]); } -EXPORT_SYMBOL(nftnl_flowtable_set); +EXPORT_SYMBOL(nftnl_flowtable_set_u32); void nftnl_flowtable_set_u32(struct nftnl_flowtable *c, uint16_t attr, uint32_t data) { nftnl_flowtable_set_data(c, attr, &data, sizeof(uint32_t)); } -EXPORT_SYMBOL(nftnl_flowtable_set_u32); +EXPORT_SYMBOL(nftnl_flowtable_set_s32); void nftnl_flowtable_set_s32(struct nftnl_flowtable *c, uint16_t attr, int32_t data) { nftnl_flowtable_set_data(c, attr, &data, sizeof(int32_t)); } -EXPORT_SYMBOL(nftnl_flowtable_set_s32); +EXPORT_SYMBOL(nftnl_flowtable_set_str); int nftnl_flowtable_set_str(struct nftnl_flowtable *c, uint16_t attr, const char *str) { return nftnl_flowtable_set_data(c, attr, str, strlen(str) + 1); } -EXPORT_SYMBOL(nftnl_flowtable_set_str); +EXPORT_SYMBOL(nftnl_flowtable_get_data); const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c, uint16_t attr, uint32_t *data_len) { @@ -228,21 +229,21 @@ const void *nftnl_flowtable_get_data(const struct nftnl_flowtable *c, } return NULL; } -EXPORT_SYMBOL(nftnl_flowtable_get_data); +EXPORT_SYMBOL(nftnl_flowtable_get); const void *nftnl_flowtable_get(const struct nftnl_flowtable *c, uint16_t attr) { uint32_t data_len; return nftnl_flowtable_get_data(c, attr, &data_len); } -EXPORT_SYMBOL(nftnl_flowtable_get); +EXPORT_SYMBOL(nftnl_flowtable_get_str); const char *nftnl_flowtable_get_str(const struct nftnl_flowtable *c, uint16_t attr) { return nftnl_flowtable_get(c, attr); } -EXPORT_SYMBOL(nftnl_flowtable_get_str); +EXPORT_SYMBOL(nftnl_flowtable_get_u32); uint32_t nftnl_flowtable_get_u32(const struct nftnl_flowtable *c, uint16_t attr) { uint32_t data_len = 0; @@ -252,8 +253,8 @@ uint32_t nftnl_flowtable_get_u32(const struct nftnl_flowtable *c, uint16_t attr) return val ? *val : 0; } -EXPORT_SYMBOL(nftnl_flowtable_get_u32); +EXPORT_SYMBOL(nftnl_flowtable_get_s32); int32_t nftnl_flowtable_get_s32(const struct nftnl_flowtable *c, uint16_t attr) { uint32_t data_len = 0; @@ -263,8 +264,8 @@ int32_t nftnl_flowtable_get_s32(const struct nftnl_flowtable *c, uint16_t attr) return val ? *val : 0; } -EXPORT_SYMBOL(nftnl_flowtable_get_s32); +EXPORT_SYMBOL(nftnl_flowtable_nlmsg_build_payload); void nftnl_flowtable_nlmsg_build_payload(struct nlmsghdr *nlh, const struct nftnl_flowtable *c) { @@ -300,7 +301,6 @@ void nftnl_flowtable_nlmsg_build_payload(struct nlmsghdr *nlh, if (c->flags & (1 << NFTNL_FLOWTABLE_SIZE)) mnl_attr_put_u32(nlh, NFTA_FLOWTABLE_SIZE, htonl(c->size)); } -EXPORT_SYMBOL(nftnl_flowtable_nlmsg_build_payload); static int nftnl_flowtable_parse_attr_cb(const struct nlattr *attr, void *data) { @@ -418,6 +418,7 @@ static int nftnl_flowtable_parse_hook(struct nlattr *attr, struct nftnl_flowtabl return 0; } +EXPORT_SYMBOL(nftnl_flowtable_nlmsg_parse); int nftnl_flowtable_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_flowtable *c) { struct nlattr *tb[NFTA_FLOWTABLE_MAX + 1] = {}; @@ -466,7 +467,6 @@ int nftnl_flowtable_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_flowtab return ret; } -EXPORT_SYMBOL(nftnl_flowtable_nlmsg_parse); static const char *nftnl_hooknum2str(int family, int hooknum) { @@ -519,14 +519,15 @@ static inline int nftnl_str2hooknum(int family, const char *hook) return -1; } +EXPORT_SYMBOL(nftnl_flowtable_parse); int nftnl_flowtable_parse(struct nftnl_flowtable *c, enum nftnl_parse_type type, const char *data, struct nftnl_parse_err *err) { errno = EOPNOTSUPP; return -1; } -EXPORT_SYMBOL(nftnl_flowtable_parse); +EXPORT_SYMBOL(nftnl_flowtable_parse_file); int nftnl_flowtable_parse_file(struct nftnl_flowtable *c, enum nftnl_parse_type type, FILE *fp, struct nftnl_parse_err *err) @@ -534,7 +535,6 @@ int nftnl_flowtable_parse_file(struct nftnl_flowtable *c, errno = EOPNOTSUPP; return -1; } -EXPORT_SYMBOL(nftnl_flowtable_parse_file); static int nftnl_flowtable_snprintf_default(char *buf, size_t size, const struct nftnl_flowtable *c) @@ -590,6 +590,7 @@ static int nftnl_flowtable_cmd_snprintf(char *buf, size_t size, return offset; } +EXPORT_SYMBOL(nftnl_flowtable_snprintf); int nftnl_flowtable_snprintf(char *buf, size_t size, const struct nftnl_flowtable *c, uint32_t type, uint32_t flags) { @@ -599,7 +600,6 @@ int nftnl_flowtable_snprintf(char *buf, size_t size, const struct nftnl_flowtabl return nftnl_flowtable_cmd_snprintf(buf, size, c, nftnl_flag2cmd(flags), type, flags); } -EXPORT_SYMBOL(nftnl_flowtable_snprintf); static int nftnl_flowtable_do_snprintf(char *buf, size_t size, const void *c, uint32_t cmd, uint32_t type, uint32_t flags) @@ -607,18 +607,19 @@ static int nftnl_flowtable_do_snprintf(char *buf, size_t size, const void *c, return nftnl_flowtable_snprintf(buf, size, c, type, flags); } +EXPORT_SYMBOL(nftnl_flowtable_fprintf); int nftnl_flowtable_fprintf(FILE *fp, const struct nftnl_flowtable *c, uint32_t type, uint32_t flags) { return nftnl_fprintf(fp, c, NFTNL_CMD_UNSPEC, type, flags, nftnl_flowtable_do_snprintf); } -EXPORT_SYMBOL(nftnl_flowtable_fprintf); struct nftnl_flowtable_list { struct list_head list; }; +EXPORT_SYMBOL(nftnl_flowtable_list_alloc); struct nftnl_flowtable_list *nftnl_flowtable_list_alloc(void) { struct nftnl_flowtable_list *list; @@ -631,8 +632,8 @@ struct nftnl_flowtable_list *nftnl_flowtable_list_alloc(void) return list; } -EXPORT_SYMBOL(nftnl_flowtable_list_alloc); +EXPORT_SYMBOL(nftnl_flowtable_list_free); void nftnl_flowtable_list_free(struct nftnl_flowtable_list *list) { struct nftnl_flowtable *s, *tmp; @@ -643,34 +644,34 @@ void nftnl_flowtable_list_free(struct nftnl_flowtable_list *list) } xfree(list); } -EXPORT_SYMBOL(nftnl_flowtable_list_free); +EXPORT_SYMBOL(nftnl_flowtable_list_is_empty); int nftnl_flowtable_list_is_empty(const struct nftnl_flowtable_list *list) { return list_empty(&list->list); } -EXPORT_SYMBOL(nftnl_flowtable_list_is_empty); +EXPORT_SYMBOL(nftnl_flowtable_list_add); void nftnl_flowtable_list_add(struct nftnl_flowtable *s, struct nftnl_flowtable_list *list) { list_add(&s->head, &list->list); } -EXPORT_SYMBOL(nftnl_flowtable_list_add); +EXPORT_SYMBOL(nftnl_flowtable_list_add_tail); void nftnl_flowtable_list_add_tail(struct nftnl_flowtable *s, struct nftnl_flowtable_list *list) { list_add_tail(&s->head, &list->list); } -EXPORT_SYMBOL(nftnl_flowtable_list_add_tail); +EXPORT_SYMBOL(nftnl_flowtable_list_del); void nftnl_flowtable_list_del(struct nftnl_flowtable *s) { list_del(&s->head); } -EXPORT_SYMBOL(nftnl_flowtable_list_del); +EXPORT_SYMBOL(nftnl_flowtable_list_foreach); int nftnl_flowtable_list_foreach(struct nftnl_flowtable_list *flowtable_list, int (*cb)(struct nftnl_flowtable *t, void *data), void *data) { @@ -684,4 +685,3 @@ int nftnl_flowtable_list_foreach(struct nftnl_flowtable_list *flowtable_list, } return 0; } -EXPORT_SYMBOL(nftnl_flowtable_list_foreach); -- 2.23.0