netfilter: conntrack: Guard possible unused functions
Subsystems (3)
PATCH v3 1/1 netfilter: conntrack: Guard possible unused functions
Some of the functions may be unused (CONFIG_NETFILTER_NETLINK_GLUE_CT=n and CONFIG_NF_CONNTRACK_EVENTS=n), it prevents kernel builds with clang, make W=1 and CONFIG_WERROR=y:
net/netfilter/nf_conntrack_netlink.c:657:22: error: unused function 'ctnetlink_acct_size' [-Werror,-Wunused-function]
657 | static inline size_t ctnetlink_acct_size(const struct nf_conn *ct)
| ^~~~~~~~~~~~~~~~~~~
net/netfilter/nf_conntrack_netlink.c:667:19: error: unused function 'ctnetlink_secctx_size' [-Werror,-Wunused-function]
667 | static inline int ctnetlink_secctx_size(const struct nf_conn *ct)
| ^~~~~~~~~~~~~~~~~~~~~
net/netfilter/nf_conntrack_netlink.c:683:22: error: unused function 'ctnetlink_timestamp_size' [-Werror,-Wunused-function]
683 | static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct)
| ^~~~~~~~~~~~~~~~~~~~~~~~Fix this by guarding possible unused functions with ifdeffery.
See also commit 6863f5643dd7 ("kbuild: allow Clang to find unused static inline functions for W=1 build").
---
v3: explicitly mentioned the configuration options that lead to issue (Simon)
v2: fixed typo, dropped Fixes (Simon), optimised by reusing existing ifdeffery
net/netfilter/nf_conntrack_netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_conntrack_netlink.c +1 -1
@@ -652,7 +652,6 @@ static size_t ctnetlink_proto_size(const struct nf_conn *ct)return len + len4; } -#endif static inline size_t ctnetlink_acct_size (const struct nf_conn *ct) {
@@ -690,6 +689,7 @@ static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct)return 0 ; #endif } +#endif #ifdef CONFIG_NF_CONNTRACK_EVENTS static size_t ctnetlink_nlmsg_size (const struct nf_conn *ct)
Signature · 1 line
2.43.0.rc1.1336.g36b5255a03ac
Quoted 16 lines · Andy Shevchenko
Some of the functions may be unused (
CONFIG_NETFILTER_NETLINK_GLUE_CT=nandCONFIG_NF_CONNTRACK_EVENTS=n), it prevents kernel builds with clang,make W=1andCONFIG_WERROR=y:
net/netfilter/nf_conntrack_netlink.c:657:22: error: unused function 'ctnetlink_acct_size' [-Werror,-Wunused-function]
657 | static inlinesize_tctnetlink_acct_size(const struct nf_conn *ct)| ^~~~~~~~~~~~~~~~~~~ net/netfilter/nf_conntrack_netlink.c:667:19: error: unused function 'ctnetlink_secctx_size' [-Werror,-Wunused-function] 667 | static inline int ctnetlink_secctx_size(const struct nf_conn *ct) | ^~~~~~~~~~~~~~~~~~~~~ net/netfilter/nf_conntrack_netlink.c:683:22: error: unused function 'ctnetlink_timestamp_size' [-Werror,-Wunused-function] 683 | static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct) | ^~~~~~~~~~~~~~~~~~~~~~~~Fix this by guarding possible unused functions with ifdeffery.
Quoted 8 lines
See also commit
6863f5643dd7("kbuild: allow Clang to find unused static inline functions for W=1 build").Signed-off-by Andy Shevchenko <[email protected]>---
v3: explicitly mentioned the configuration options that lead to issue (Simon)
v2: fixed typo, dropped Fixes (Simon), optimised by reusing existing ifdeffery
Thanks for the updates.
Quoted 23 lines · Simon Horman
Quoted 22 lines · Andy Shevchenko
Some of the functions may be unused (
CONFIG_NETFILTER_NETLINK_GLUE_CT=nandCONFIG_NF_CONNTRACK_EVENTS=n), it prevents kernel builds with clang,make W=1andCONFIG_WERROR=y:
net/netfilter/nf_conntrack_netlink.c:657:22: error: unused function 'ctnetlink_acct_size' [-Werror,-Wunused-function]
657 | static inlinesize_tctnetlink_acct_size(const struct nf_conn *ct)| ^~~~~~~~~~~~~~~~~~~ net/netfilter/nf_conntrack_netlink.c:667:19: error: unused function 'ctnetlink_secctx_size' [-Werror,-Wunused-function] 667 | static inline int ctnetlink_secctx_size(const struct nf_conn *ct) | ^~~~~~~~~~~~~~~~~~~~~ net/netfilter/nf_conntrack_netlink.c:683:22: error: unused function 'ctnetlink_timestamp_size' [-Werror,-Wunused-function] 683 | static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct) | ^~~~~~~~~~~~~~~~~~~~~~~~Fix this by guarding possible unused functions with ifdeffery.
See also commit
6863f5643dd7("kbuild: allow Clang to find unused static inline functions for W=1 build").Signed-off-by Andy Shevchenko <[email protected]>---
Quoted 6 lines
Quoted 2 lines
v3: explicitly mentioned the configuration options that lead to issue (Simon)
v2: fixed typo, dropped Fixes (Simon), optimised by reusing existing ifdefferyThanks for the updates.
Reviewed-by Simon Horman <[email protected]>
Applied to nf.git