[PATCH libX11 3/5] fix: warning: pointer targets in passing argument 2 of '_XSend' differ in signedness [-Wpointer-sign]
Peter Hutterer
peter.hutterer at who-t.net
Thu Apr 28 23:43:39 UTC 2016
On Thu, Apr 28, 2016 at 04:53:46PM +0200, walter harms wrote:
>
>
> Am 27.04.2016 07:04, schrieb Alan Coopersmith:
> > On 04/26/16 07:31 AM, walter harms wrote:
> >>
> >> fix signess warning by casting
> >> Signed-off-by: walter harms <wharms at bfs.de>
> >>
> >>
> >> ---
> >> src/ModMap.c | 4 ++--
> >> 1 file changed, 2 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/src/ModMap.c b/src/ModMap.c
> >> index a809aa2..4263a8b 100644
> >> --- a/src/ModMap.c
> >> +++ b/src/ModMap.c
> >> @@ -39,7 +39,7 @@ XGetModifierMapping(register Display *dpy)
> >> XModifierKeymap *res;
> >>
> >> LockDisplay(dpy);
> >> - GetEmptyReq(GetModifierMapping, req);
> >> + (GetModifierMapping, req); // Never used ?
> >> (void) _XReply (dpy, (xReply *)&rep, 0, xFalse);
> >
> > The request is used on the very next line, where it's sent to the
> > Xserver and then _XReply waits for the response. It's just all the
> > behind the scenes magic of the X request buffer handling in Xlib.
> >
> hi Alan,
>
> Actualy it was left when i was trying to understand why this causes this:
> ModMap.c:37:20: warning: variable 'req' set but not used [-Wunused-but-set-variable]
>
> i understand:
> GetEmptyReq = _XGetRequest is changing dpy what is needed in _XReply
>
> so i could get rid of that warning by checking for the (unlikely) error
> if (req == NULL ) or by something like req=req
>
> assuming that a redefine is not an option:
> #define GetEmptyReq (nane,req) (void)_XGetRequest(dpy, X_##name, SIZEOF(xReq))
>
> note: there are 17 more of this kind in libX11
fixing this isn't going to do much, and adding fake statements neither.
to fix the compiler warnings you could do something like:
#define _xlib_used_internally __attribute__((unused))
and then use that to annotate the variable. No need for fake code changes
and it's more expressive.
Cheers,
Peter
More information about the xorg-devel
mailing list