[PATCH:libxt] Fix missing const qualifier.
Alan Coopersmith
alan.coopersmith at oracle.com
Thu Nov 25 11:30:38 PST 2010
Julien Cristau wrote:
> On Thu, Nov 25, 2010 at 18:54:55 +0100, Cyril Brulebois wrote:
>
>> In libX11's c8701115, atom names argument to XInternAtoms were marked as
>> const.
>>
>> This fixes the build with CFLAGS="-Wall -Werror":
>> | CC Selection.lo
>> | cc1: warnings being treated as errors
>> | Selection.c: In function ‘GetPropList’:
>> | Selection.c:191: error: passing argument 2 of ‘XInternAtoms’ from incompatible pointer type
>> | /home/kibi/xorg-build/include/X11/Xlib.h:1549: note: expected ‘const char **’ but argument is of type ‘char **’
>>
>> Signed-off-by: Cyril Brulebois <kibi at debian.org>
>> ---
>> src/Selection.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
> Does this introduce a warning with old libX11?
Unfortunately, it seems the const char ** change to XInternAtoms means
that either old code gets warnings with new libX11 headers or new code
gets warnings with old libX11 headers. I missed this when testing
somehow and had been expecting it to silently accept non-const arguments
as it does when we pass a char * to a function defining its arguments
as const char *.
Of course, most applications are passing constant/literal strings to these
functions, so declaring it const seems the right thing, but breaking -Werror
builds that used to work is unfriendly.
Anyone have a good solution? Or is it best to just revert the libX11 change?
--
-Alan Coopersmith- alan.coopersmith at oracle.com
Oracle Solaris Platform Engineering: X Window System
More information about the xorg-devel
mailing list