[PATCH libX11 3/5] fix: warning: pointer targets in passing argument 2 of '_XSend' differ in signedness [-Wpointer-sign]

walter harms wharms at bfs.de
Sat Apr 30 21:08:34 UTC 2016



Am 29.04.2016 03:03, schrieb Alan Coopersmith:
> On 04/28/16 04:43 PM, Peter Hutterer wrote:
>> 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.
> 
> Yes, if we're going to fix this, please just use attributes instead of
> adding
> confusing unused code that some other compiler will warn is being
> optimized out.
> 
> Though I'd prefer _X_UNUSED from <X11/Xfuncproto.h> over the raw attribute
> to take advantage of the existing compiler checks there to see where it's
> safe to use.
> 

I have tried _X_UNUSED register xReq *req; and it works fine.

But i still do not understand where req is used.

The code looks like that here:

  GetEmptyReq(GetModifierMapping, req);
    (void) _XReply (dpy, (xReply *)&rep, 0, xFalse);

GetEmptyReq() is a Macro and expands into this:

  req = (xReq *) _XGetRequest(dpy, X_GetModifierMapping, SIZEOF(xReq));

_XGetRequest generates a buffer inside dpy (code in XlibInt.c)

 _XReply() is a function in xcb_io.c is uses the buffer inside dpy, granted but
not req. I realy do not see why:

(void) _XGetRequest(dpy, X_GetModifierMapping, SIZEOF(xReq));
(void) _XReply (dpy, (xReply *)&rep, 0, xFalse);

should not work as the code before.

I am still willing to use _X_UNUSED but i would like to know why not remove req,
just point me to the line where it is used.

re,
 wh










More information about the xorg-devel mailing list