Skip to contentSkip to conversation

Fix compiler warning about unused register_ip_vs_protocol

PATCH In review Pavel Emelyanov 3 participants 3 messages Nov 20, 2007 – Nov 21, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix compiler warning about unused register_ip_vs_protocol

This is silly, but I have turned the CONFIG_IP_VS to m, to check the compilation of one (recently sent) fix and set all the CONFIG_IP_VS_PROTO_XXX options to n to speed up the compilation.

In this configuration the compiler warns me about

CC [M] net/ipv4/ipvs/ip_vs_proto.o
net/ipv4/ipvs/ip_vs_proto.c:49: warning: ‘register_ip_vs_protocol’ defined but not used

Indeed. With no protocols selected there are no calls to this function - all are compiled out with ifdefs.

Maybe the best fix would be to surround this call with ifdef-s or tune the Kconfig dependences, but I think that marking this register function as __used is enough. No?

---

net/ipv4/ipvs/ip_vs_proto.c +1 -1
index e844ddb..c0e11ec 100644
@@ -45,7 +45,7 @@ static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE];
 /*
  *	register an ipvs protocol
  */
-static int register_ip_vs_protocol(struct ip_vs_protocol *pp)
+static int __used register_ip_vs_protocol(struct ip_vs_protocol *pp)
 {
 	unsigned hash = IP_VS_PROTO_HASH(pp->protocol);
 
Signature · 1 line
1.5.3.4
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Pavel Emelyanov

This is silly, but I have turned the CONFIG_IP_VS to m, to check the compilation of one (recently sent) fix and set all the CONFIG_IP_VS_PROTO_XXX options to n to speed up the compilation.

In this configuration the compiler warns me about

CC [M] net/ipv4/ipvs/ip_vs_proto.o
net/ipv4/ipvs/ip_vs_proto.c:49: warning: ‘register_ip_vs_protocol’ defined but not used

Indeed. With no protocols selected there are no calls to this function - all are compiled out with ifdefs.

Quoted 5 lines

Maybe the best fix would be to surround this call with ifdef-s or tune the Kconfig dependences, but I think that marking this register function as __used is enough. No?

That is kind of interesting.

On the one hand it might be more correct in some way to use some Kconfig foo to get rid of register_ip_vs_protocol, and also most of the body of ‘register_ip_vs_protocol() if no protocols are defined.

But on the other hand, its really a corner case, because in practice if you are going to use IPVS then you are going to need at least one protocol. So I'm happy with the simplicity of the __used solution, even though strictly speaking it is a lie.

Quoted 23 lines

---

net/ipv4/ipvs/ip_vs_proto.c +1 -1
index e844ddb..c0e11ec 100644
@@ -45,7 +45,7 @@ static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE];
 /*
  *	register an ipvs protocol
  */
-static int register_ip_vs_protocol(struct ip_vs_protocol *pp)
+static int __used register_ip_vs_protocol(struct ip_vs_protocol *pp)
 {
 	unsigned hash = IP_VS_PROTO_HASH(pp->protocol);
 
Signature · 6 lines
1.5.3.4

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Horms
maintainer
#2 lore raw

From: Simon Horman <[email protected]>
Date: Wed, 21 Nov 2007 10:38:02 +0900

Quoted 27 lines · Pavel Emelyanov
Quoted 14 lines

This is silly, but I have turned the CONFIG_IP_VS to m, to check the compilation of one (recently sent) fix and set all the CONFIG_IP_VS_PROTO_XXX options to n to speed up the compilation.

In this configuration the compiler warns me about

CC [M] net/ipv4/ipvs/ip_vs_proto.o
net/ipv4/ipvs/ip_vs_proto.c:49: warning: ‘register_ip_vs_protocol’ defined but not used

Indeed. With no protocols selected there are no calls to this function - all are compiled out with ifdefs.

Quoted 5 lines

Maybe the best fix would be to surround this call with ifdef-s or tune the Kconfig dependences, but I think that marking this register function as __used is enough. No?

That is kind of interesting.

On the one hand it might be more correct in some way to use some Kconfig foo to get rid of register_ip_vs_protocol, and also most of the body of ‘register_ip_vs_protocol() if no protocols are defined.

Quoted 6 lines

But on the other hand, its really a corner case, because in practice if you are going to use IPVS then you are going to need at least one protocol. So I'm happy with the simplicity of the __used solution, even though strictly speaking it is a lie.

Ok, I've applied Pavel's patch.