Compiler warnings unnecessarily caused by X11 headers

Peter Breitenlohner peb at mppmu.mpg.de
Tue Sep 29 06:33:34 PDT 2009


Hi,

it may be useful to compile programs with
 	gcc -Wall -Wwrite-strings -Wcast-qual
but unfortunately doing this causes numerous compiler warnings when defining
X11 resources.  Attached is a small example resulting in 13 warnings
 	8 initialization discards qualifiers...
 	5 cast discards qualifiers...

All this is due to struct members declared as 'char *' or (char *) casts,
that actually should be 'const char *' or maybe '_Xconst char *'.

I'd think that it is about time to make these changes (knowing well that
they will imply corresponding changes in many other declarations).

Doing this right will, however, also be a good check that these string are
not modified by the X11 library code.

Regards
Peter Breitenlohner <peb at mppmu.mpg.de>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: play.c
URL: <http://lists.x.org/archives/xorg/attachments/20090929/307795e8/attachment.c>


More information about the xorg mailing list