[PATCH:libX11 1/2] Bug 32098: Making XInternAtoms take const char ** breaks callers
daniel at fooishbar.org
Tue Dec 14 04:16:17 PST 2010
On Mon, Dec 13, 2010 at 05:22:58PM -0800, Alan Coopersmith wrote:
> Callers who had successfully built without issues with the existing
> libX11 headers were suddenly either given warnings or errors (-Werror)
> with the new headers.
> This compromise solution allows us to move to the correct declaration
> without breaking such callers - if they simply include the headers as
> is, nothing changes for them. If they want to take advantage of the
> new const declaration to avoid getting warnings from passing arrays of
> string literals, then they can #define XINTERNATOMS_WANT_CONST_NAMES
> before they #include <X11/Xlib.h>. Callers using pkg-config will
> eventually be able to require x11 > 1.4 to get this - those not using
> pkg-config or not wanting a hard requirement can simply check after
> the #include <X11/Xlib.h> for #ifdef XINTERNATOMS_HAVE_CONST_NAMES
> to see if the header is new enough to have satisfied their request.
Hm, I'm really not wild about this at all. Getting all our types right
is hard enough as it is, and I suspect we're just going to have problems
with this leaking anyway. What happens if a toolkit and an app, or an
app and a helper library, or whatever, disagree on whether or not the
arguments need to be const?
I'd say that we should just chalk this down as yet another Xlib API
mistake, and people who need it to be const can just do the cast, take
the warning if necessary, and move on with their lives. Or move on to
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 198 bytes
Desc: Digital signature
More information about the xorg-devel