[cairo] Making cairo_error weak

Keith Packard keithp at keithp.com
Wed Aug 17 15:10:23 PDT 2005


On Wed, 2005-08-17 at 14:38 -0700, Carl Worth wrote:
> On Wed, 17 Aug 2005 13:43:15 -0400,  wrote:
> > Quoting Keith Packard <keithp at keithp.com>:
> > 
> > > I've been fairly happy using environment variables to control
> > > diagnostic printfs of this nature. It means you can see problems
> > > even when the application developer hasn't made any provisions for
> > > such.
> > 
> > So long as the messages are off by default.  Unexpected diagnostic
> > printfs can be very obnoxious on e.g. win32, as I experienced with
> > libart.
> 
> Yes, that's my plan.
> 
> By default, I want cairo to never print, but I want to add printing in
> _cairo_error that's conditional on an environment variable.
> Suggestions for the name of the variable?

I'd use CAIRO_DEBUG and may even make it a bitmask like fontconfig does
so that we could add other debugging in the future for pieces of the
library. You might look at what fontconfig does with FC_DEBUG; it's been
invaluable in diagnosing application difficulties without any
application assistance.

> 
> Meanwhile, we'll also likely want a way to get the calling
> __FUNCTION__ to that print message, and we'll likely also need to push
> a few calls of _cairo_error up closer so that the function name that
> gets printed is the actual function called by application code, and
> not something buried deeper in cairo that won't be helpful to the
> person trying to fix their program based on this message being
> printed.

If you want to get very fancy, we could easily reconstruct the call
history...

-keith

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050817/67d8a05a/attachment-0001.pgp


More information about the cairo mailing list