[cairo] Conditionally include debug functions with ENABLE_DEBUG_FUNCS

BJörn Lindqvist bjourne at gmail.com
Fri Oct 26 08:15:35 PDT 2007


Hello!

On 10/18/07, Carl Worth <cworth at cworth.org> wrote:
> Could you please put a CAIRO_ prefix into the macro name? And also,
> I'm a little bit concerned about the name "enable debug funcs" since
> it suggests that a function like cairo_debug_reset_stat_data would not
> exist unless this option were set, (which is not the case). Does
> anybody have an alternate naming suggestion for the new macro?
>
> Similarly, the cairo_xlib_surface_disable_render function should be
> named such that it is clearly associated with the new option.
>
> >       make check
> >
> > +   This requires that Cairo is configured with --enable-debug-funcs.
> > +
>
> Can't we make the test suite work unconditionally, but perhaps with
> less coverage in the case of the debugging function not existing? That
> is, just sprinkle some "#if CAIRO_ENABLE_DEBUG_FUNCS" throughout
> cairo-boilerplate as necessary?

Are you sure about that? I mean if you are running the test suite,
then I think that you also are quite capable of recompiling Cairo with
the test API included.

> If you don't go this route, I'd at least like to see a kind warning
> from "make check" explaining how to build cairo properly for testing,
> (as opposed to just an obscure build failure due to an undefined
> symbol as I think will result with the current patch).

Alright, there should now be a warning when typing make test, retest,
recheck, check, check-valgrind and perf. Note that you only get the
warning when you type the command in Cairo's root directory. That is,
if you enter the test directory and type make, you will still get a
compile error. Which is exactly what would have happened if Cairo was
configured without libpng.

> This warning message gives some naming hints. I don't think
> "diagnostic" is accurate and it should just be dropped. But the fact
> that the functions are needed only by the test suites is quite
> accurate. So maybe that's the direction we want for naming?

I have fixed that I think.

> Maybe something like this?
>
>         --enable-test-functions
>
>         CAIRO_HAS_TEST_FUNCTIONS
>
>         cairo_xlib_surface_test_disable_render
>
> And actually, the existing functionality of --enable-test-surfaces
> should probably be combined as well. There's nothing useful that I can
> see in keeping these separate.
>
> So maybe it's --enable-test-build ? CAIRO_IS_TEST_BUILD?
>
> Something like that anyway.

Ok. I have merged the --enable-test-functions and
--enable-test-surfaces to --enable-test-build with the macro name
CAIRO_IS_TEST_BUILD and with your proposed name for the function.
Please review the attached patch.


-- 
mvh Björn
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cairo-define-to-compile-test-API-v2.patch
Type: text/x-patch
Size: 12460 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20071026/61d4ceed/attachment-0001.bin 


More information about the cairo mailing list