OpenVZ Forum


Home » Mailing lists » Devel » [PATCH][IPVS] Fix compiler warning about unused register_ip_vs_protocol
[PATCH][IPVS] Fix compiler warning about unused register_ip_vs_protocol [message #23564] Tue, 20 November 2007 12:08 Go to next message
Pavel Emelianov is currently offline  Pavel Emelianov
Messages: 1149
Registered: September 2006
Senior Member
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?

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c
index e844ddb..c0e11ec 100644
--- a/net/ipv4/ipvs/ip_vs_proto.c
+++ b/net/ipv4/ipvs/ip_vs_proto.c
@@ -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);
 
-- 
1.5.3.4
Re: [PATCH][IPVS] Fix compiler warning about unused register_ip_vs_protocol [message #23565 is a reply to message #23564] Tue, 20 November 2007 12:12 Go to previous messageGo to next message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Pavel Emelyanov <xemul@openvz.org>
Date: Tue, 20 Nov 2007 15:08:42 +0300

> 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?
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

No nice solutions indeed.

Simon, how should do you think we should handle this?

> diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c
> index e844ddb..c0e11ec 100644
> --- a/net/ipv4/ipvs/ip_vs_proto.c
> +++ b/net/ipv4/ipvs/ip_vs_proto.c
> @@ -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);
>  
> -- 
> 1.5.3.4
>
Re: [PATCH][IPVS] Fix compiler warning about unused register_ip_vs_protocol [message #23602 is a reply to message #23564] Wed, 21 November 2007 01:38 Go to previous messageGo to next message
Simon Horman is currently offline  Simon Horman
Messages: 8
Registered: April 2007
Junior Member
On Tue, Nov 20, 2007 at 03:08:42PM +0300, Pavel Emelyanov wrote:
> 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: $B!F(Bregister_ip_vs_protocol$B!G(B 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?
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

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 $B!F(Bregister_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.

Acked-by: Simon Horman <horms@verge.net.au>

> 
> ---
> 
> diff --git a/net/ipv4/ipvs/ip_vs_proto.c b/net/ipv4/ipvs/ip_vs_proto.c
> index e844ddb..c0e11ec 100644
> --- a/net/ipv4/ipvs/ip_vs_proto.c
> +++ b/net/ipv4/ipvs/ip_vs_proto.c
> @@ -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);
>  
> -- 
> 1.5.3.4
> 
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Horms
Re: [PATCH][IPVS] Fix compiler warning about unused register_ip_vs_protocol [message #23603 is a reply to message #23602] Wed, 21 November 2007 01:44 Go to previous message
davem is currently offline  davem
Messages: 463
Registered: February 2006
Senior Member
From: Simon Horman <horms@verge.net.au>
Date: Wed, 21 Nov 2007 10:38:02 +0900

> On Tue, Nov 20, 2007 at 03:08:42PM +0300, Pavel Emelyanov wrote:
> > 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: $B!F(Bregister_ip_vs_protocol$B!G(B 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?
> > 
> > Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
> 
> 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 $B!F(Bregister_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.
> 
> Acked-by: Simon Horman <horms@verge.net.au>

Ok, I've applied Pavel's patch.
Previous Topic: git.openvz.org update
Next Topic: [PATCH (resend)][DOCUMENTATION] The namespaces compatibility list doc
Goto Forum:
  


Current Time: Sat Nov 09 03:33:25 GMT 2024

Total time taken to generate the page: 0.05324 seconds