[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: |
Sun, 24 Jul 2016 17:35:23 +0300 |
> From: Andy Wingo <address@hidden>
> Cc: address@hidden
> Date: Sat, 23 Jul 2016 22:55:50 +0200
>
> > 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;
> > ^
> >
> > The patch to avoid this warning is below. OK to commit?
>
> I don't think so -- whether the underlying system has scope_id or no, we
> need this assert to happen:
>
> > +#ifdef HAVE_SIN6_SCOPE_ID
> > SCM_VALIDATE_ULONG_COPY (which_arg + 3, SCM_CAR (*args),
> > scope_id);
> > +#endif
>
> Not sure what the right solution is.
How about something this instead:
#ifdef HAVE_SIN6_SCOPE_ID
SCM_VALIDATE_ULONG_COPY (which_arg + 3, SCM_CAR (*args),
scope_id);
#else
(void)SCM_NUM2ULONG (which_arg + 3, SCM_CAR (*args));
#endif