From 5cb18fcec7d973595e4e8ae992ce84836b815ce4 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 14 Jun 2011 15:34:09 +0200 Subject: [PATCH] test: Fix compilation on win32 The Microsoft C Compiler does not accept empty-initialized arrays: cairo-boilerplate-win32-printing.c(373) : error C2059: syntax error : '}' cairo-boilerplate-win32-printing.c(374) : warning C4034: sizeof returns 0 --- boilerplate/cairo-boilerplate-pdf.c | 9 ++++++--- boilerplate/cairo-boilerplate-private.h | 4 ++++ boilerplate/cairo-boilerplate-ps.c | 10 ++++++++-- boilerplate/cairo-boilerplate-svg.c | 10 ++++++++-- boilerplate/cairo-boilerplate-win32-printing.c | 10 ++++++++-- 5 files changed, 34 insertions(+), 9 deletions(-) diff --git a/boilerplate/cairo-boilerplate-pdf.c b/boilerplate/cairo-boilerplate-pdf.c index 53bf55bae..9854344d2 100644 --- a/boilerplate/cairo-boilerplate-pdf.c +++ b/boilerplate/cairo-boilerplate-pdf.c @@ -238,10 +238,8 @@ _cairo_boilerplate_pdf_force_fallbacks (cairo_surface_t *abstract_surface, x_pixels_per_inch, y_pixels_per_inch); } -#endif static const cairo_boilerplate_target_t targets[] = { -#if CAIRO_CAN_TEST_PDF_SURFACE { "pdf", "pdf", ".pdf", NULL, CAIRO_SURFACE_TYPE_PDF, @@ -269,6 +267,11 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_pdf_cleanup, NULL, NULL, FALSE, TRUE, TRUE }, -#endif }; CAIRO_BOILERPLATE (pdf, targets) + +#else + +CAIRO_NO_BOILERPLATE (pdf) + +#endif diff --git a/boilerplate/cairo-boilerplate-private.h b/boilerplate/cairo-boilerplate-private.h index a848aa1cf..a7a2dd0eb 100644 --- a/boilerplate/cairo-boilerplate-private.h +++ b/boilerplate/cairo-boilerplate-private.h @@ -44,6 +44,10 @@ void _register_##name__ (void) { \ sizeof (targets__) / sizeof (targets__[0])); \ } +#define CAIRO_NO_BOILERPLATE(name__) \ +void _register_##name__ (void); \ +void _register_##name__ (void) { } + CAIRO_END_DECLS #endif /* _CAIRO_BOILERPLATE_PRIVATE_H_ */ diff --git a/boilerplate/cairo-boilerplate-ps.c b/boilerplate/cairo-boilerplate-ps.c index a3f75077d..c3f06941c 100644 --- a/boilerplate/cairo-boilerplate-ps.c +++ b/boilerplate/cairo-boilerplate-ps.c @@ -26,6 +26,8 @@ #include "cairo-boilerplate-private.h" +#if CAIRO_CAN_TEST_PS_SURFACE + #include #include @@ -302,7 +304,6 @@ _cairo_boilerplate_ps_force_fallbacks (cairo_surface_t *abstract_surface, } static const cairo_boilerplate_target_t targets[] = { -#if CAIRO_CAN_TEST_PS_SURFACE { "ps2", "ps", ".ps", NULL, CAIRO_SURFACE_TYPE_PS, @@ -357,6 +358,11 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_ps_cleanup, NULL, NULL, FALSE, TRUE, TRUE }, -#endif }; CAIRO_BOILERPLATE (ps, targets) + +#else + +CAIRO_NO_BOILERPLATE (ps) + +#endif diff --git a/boilerplate/cairo-boilerplate-svg.c b/boilerplate/cairo-boilerplate-svg.c index b5a7d0d73..10fddb6b9 100644 --- a/boilerplate/cairo-boilerplate-svg.c +++ b/boilerplate/cairo-boilerplate-svg.c @@ -26,6 +26,8 @@ #include "cairo-boilerplate-private.h" +#if CAIRO_CAN_TEST_SVG_SURFACE + #include #include #include @@ -274,7 +276,6 @@ _cairo_boilerplate_svg_force_fallbacks (cairo_surface_t *abstract_surface, } static const cairo_boilerplate_target_t targets[] = { -#if CAIRO_CAN_TEST_SVG_SURFACE /* It seems we should be able to round-trip SVG content perfectly * through librsvg and cairo, but for some mysterious reason, some * systems get an error of 1 for some pixels on some of the text @@ -332,6 +333,11 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_svg_cleanup, NULL, NULL, FALSE, TRUE, TRUE }, -#endif }; CAIRO_BOILERPLATE (svg, targets) + +#else + +CAIRO_NO_BOILERPLATE (svg) + +#endif diff --git a/boilerplate/cairo-boilerplate-win32-printing.c b/boilerplate/cairo-boilerplate-win32-printing.c index ee76bf641..0e54512ae 100644 --- a/boilerplate/cairo-boilerplate-win32-printing.c +++ b/boilerplate/cairo-boilerplate-win32-printing.c @@ -36,6 +36,8 @@ #include "cairo-boilerplate-private.h" +#if CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE + #include #include #include @@ -343,7 +345,6 @@ _cairo_boilerplate_win32_printing_cleanup (void *closure) } static const cairo_boilerplate_target_t targets[] = { -#if CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE { "win32-printing", "win32", ".ps", NULL, CAIRO_SURFACE_TYPE_WIN32_PRINTING, @@ -369,6 +370,11 @@ static const cairo_boilerplate_target_t targets[] = { _cairo_boilerplate_win32_printing_cleanup, NULL, NULL, FALSE, TRUE, TRUE }, -#endif }; CAIRO_BOILERPLATE (win32_printing, targets) + +#else + +CAIRO_NO_BOILERPLATE (win32_printing) + +#endif