[cairo] Cleaning up cairo-features.h

Carl Worth cworth at redhat.com
Mon May 9 08:37:34 PDT 2005


On Sat, 07 May 2005 12:28:34 -0400, Owen Taylor wrote [in a different order]:
> In addition to being standard, that allows all four of:
> 
>  #if CAIRO_HAS_XLIB_SURFACE
>  #if !CAIRO_HAS_XLIB_SURFACE
>  #ifdef CAIRO_HAS_XLIB_SURFACE
>  #ifndef CAIRO_HAS_XLIB_SURFACE

Allowing all four is definitely a feature. That's clearly what's
desired.

> While with the definition you propose above, the #ifdef and
> #ifndef don't work. (Silently do the wrong thing)

Yes, I botched this. I also foolishly didn't realize that the original
version of cairo-features.h worked fine with all four of the forms
above. I hadn't realized it's perfectly valid to test an undefined
macro with #if, since it looks like it really wants to be an error.

> Is there really a benefit from deviating from the standard 
> of:
> 
>  #define CAIRO_HAS_XLIB_SURFACE 1
> 
> vs.
> 
>  /* Nothing */

I think what I was going for in avoiding *nothing* in the
missing-feature case was a way to inform the user that something was
left out that might be interesting. But that's only mildly useful at
best, and perhaps not worthing adding definitions that we never expect
anyone to actually use.

I've now committed a change to use this approach. The only other
inelegance of this latest patch is that there are blank lines in the
generated header for missing features. It's not something I'm going to
worry about, but I'd commit a fix for it if I thought of simple way to
do it.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050509/e25e1491/attachment.pgp


More information about the cairo mailing list