Bug 4874

Summary: string constants in X11/StringDefs.h discard const qualifier
Product: xorg Reporter: Andrew J. Schorr <aschorr>
Component: Lib/XtAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: minor    
Priority: high Keywords: love
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:

Description Andrew J. Schorr 2005-10-25 06:58:31 UTC
In <X11/StringDefs.h>, we have the following:

#define _XtStringDefs_h_Const const

extern _XtStringDefs_h_Const char XtStrings[];

#define XtNaccelerators ((char*)&XtStrings[0])
...

So the cast in the define is discarding the const qualifier, and gcc
complains whenever one of these defines is used:

warning: cast discards qualifiers from pointer target type

Why is the cast there at all?  Why not simply have:

#define XtNaccelerators (&XtStrings[0])

I guess this would be a simple patch to the makestrs program.  The current
behavior seems to be hard-wired into the IntelABIWriteHeader()
and DefaultWriteHeader() functions...

Regards,
Andy
Comment 1 Daniel Stone 2007-02-27 01:28:32 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 2 GitLab Migration User 2018-08-10 20:01:39 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/lib/libxt/issues/1.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.