guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Avoid warnings in sockets.c when HAVE_SIN6_SCOPE_ID is unavailable


From: Eli Zaretskii
Subject: Re: Avoid warnings in sockets.c when HAVE_SIN6_SCOPE_ID is unavailable
Date: Sat, 13 Aug 2016 10:17:07 +0300

> From: Mark H Weaver <address@hidden>
> Cc: address@hidden
> Date: Wed, 10 Aug 2016 02:49:08 -0400
> 
> Hi Eli,
> 
> Eli Zaretskii <address@hidden> writes:
> 
> >     CC       libguile_2.0_la-socket.lo
> >   socket.c: In function 'scm_fill_sockaddr':
> >   socket.c:747:16: warning: variable 'scope_id' set but not used 
> > [-Wunused-but-set-variable]
> >     unsigned long scope_id = 0;
> >               ^
> 
> How about this?
> 
> --8<---------------cut here---------------start------------->8---
> diff --git a/libguile/socket.c b/libguile/socket.c
> index 3229ac8..beff305 100644
> --- a/libguile/socket.c
> +++ b/libguile/socket.c
> @@ -744,7 +744,7 @@ scm_fill_sockaddr (int fam, SCM address, SCM *args, int 
> which_arg,
>       int port;
>       struct sockaddr_in6 *soka;
>       unsigned long flowinfo = 0;
> -     unsigned long scope_id = 0;
> +     unsigned long scope_id SCM_UNUSED = 0;
>  
>       SCM_VALIDATE_CONS (which_arg + 1, *args);
>       port = scm_to_int (SCM_CAR (*args));
> --8<---------------cut here---------------end--------------->8---
> 
> See the definition of SCM_UNUSED in __scm.h.

Works for me (no warning after applying the patch), but couldn't this
be harmful for builds that do use the variable, by omitting real
warnings?  If it could, maybe make the use of SCM_UNUSED be
conditional on HAVE_SIN6_SCOPE_ID being defined?

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]