[PATCH:xrandr 2/2] Use __UNCONST to work around const problem.

Thomas Klausner wiz at NetBSD.org
Sun Jun 2 17:15:04 PDT 2013


On Mon, Jun 03, 2013 at 01:37:31AM +0200, Thomas Klausner wrote:
> On Sun, Jun 02, 2013 at 04:35:51PM -0700, Alan Coopersmith wrote:
> > On 06/ 2/13 12:30 PM, Thomas Klausner wrote:
> > >XXX: should probably be fixed differently.
> > >---
> > >  xrandr.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > >diff --git a/xrandr.c b/xrandr.c
> > >index da786cb..0b285a3 100644
> > >--- a/xrandr.c
> > >+++ b/xrandr.c
> > >@@ -1524,7 +1524,7 @@ crtc_set_transform (crtc_t *crtc, transform_t *transform)
> > >      if (major > 1 || (major == 1 && minor >= 3))
> > >  	XRRSetCrtcTransform (dpy, crtc->crtc.xid,
> > >  			     &transform->transform,
> > >-			     transform->filter,
> > >+			     __UNCONST(transform->filter),
> > >  			     transform->params,
> > >  			     transform->nparams);
> > >  }
> > >
> > 
> > Sorry, breaks the build since __UNCONST is not defined.
> 
> Yeah, needs the bits
> #ifndef __UNCONST
> #define __UNCONST(x) (x)
> #endif
> like the other patch.

Sorry about that. A bit more helpful answer: the __UNCONST(x) that
NetBSD uses is in /usr/include/sys/cdefs.h
       #define __UNCONST(a)   ((void *)(unsigned long)(const void *)(a))

Do you want a patch for the two __UNCONST uses that has that fallback
define (perhaps __XORG_UNCONST to avoid clashes), or is there a good
common place to put it?

> Better would be if we wouldn't need the unconst cast though :)

That's still true :)
 Thomas


More information about the xorg-devel mailing list