[PATCH] tests: fixed warnings on unused variables

"Enrico Weigelt, metux IT consult" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
some variables are only used when certain features are activated -
otherwise we warning noise.

-- 

mit freundlichen Grüßen
--
Enrico, Sohn von Wilfried, a.d.F. Weigelt,
metux IT consulting
+49-151-27565287

-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
0003-tests-fixed-warnings-on-unused-variables.patch (text/x-patch, 3.1 KB)
From 9ec4ae745d02468cdb426ecc3bde4419affc69f7 Mon Sep 17 00:00:00 2001
From: "Enrico Weigelt, metux IT consult" <[email protected]>
Date: Tue, 22 Dec 2015 03:18:02 +0100
Subject: [PATCH 3/6] tests: fixed warnings on unused variables

Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]>
---
 test/any2ppm.c           |  3 +++
 test/create-for-stream.c | 23 +++++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/test/any2ppm.c b/test/any2ppm.c
index b60b4d9..8ceacc1 100644
--- a/test/any2ppm.c
+++ b/test/any2ppm.c
@@ -102,6 +102,7 @@
 
 #define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
 
+#if CAIRO_HAS_INTERPRETER || CAIRO_CAN_TEST_PDF_SURFACE || CAIRO_CAN_TEST_SVG_SURFACE || CAIRO_HAS_SPECTRE
 static int
 _cairo_writen (int fd, char *buf, int len)
 {
@@ -267,6 +268,8 @@ _create_image (void *closure,
     *out = cairo_image_surface_create (format, width, height);
     return cairo_surface_reference (*out);
 }
+#endif /* CAIRO_HAS_INTERPRETER || CAIRO_CAN_TEST_PDF_SURFACE || CAIRO_CAN_TEST_SVG_SURFACE || CAIRO_HAS_SPECTRE */
+
 
 #if CAIRO_HAS_INTERPRETER
 static const char *
diff --git a/test/create-for-stream.c b/test/create-for-stream.c
index af1632f..aafb97c 100644
--- a/test/create-for-stream.c
+++ b/test/create-for-stream.c
@@ -59,6 +59,8 @@
 
 #define BASENAME "create-for-stream.out"
 
+#if CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE || CAIRO_HAS_SVG_SURFACE
+
 static cairo_test_status_t
 draw (cairo_t *cr, int width, int height)
 {
@@ -238,14 +240,15 @@ static cairo_test_status_t
 preamble (cairo_test_context_t *ctx)
 {
     cairo_test_status_t status = CAIRO_TEST_UNTESTED;
-    cairo_test_status_t test_status;
-    char *filename;
     const char *path = cairo_test_mkdir (CAIRO_TEST_OUTPUT_DIR) ? CAIRO_TEST_OUTPUT_DIR : ".";
 
 #if CAIRO_HAS_PS_SURFACE
     if (cairo_test_is_target_enabled (ctx, "ps2") ||
 	cairo_test_is_target_enabled (ctx, "ps3"))
     {
+	cairo_test_status_t test_status;
+	char *filename;
+
 	if (status == CAIRO_TEST_UNTESTED)
 	    status = CAIRO_TEST_SUCCESS;
 
@@ -264,6 +267,9 @@ preamble (cairo_test_context_t *ctx)
 
 #if CAIRO_HAS_PDF_SURFACE
     if (cairo_test_is_target_enabled (ctx, "pdf")) {
+	cairo_test_status_t test_status;
+	char *filename;
+
 	if (status == CAIRO_TEST_UNTESTED)
 	    status = CAIRO_TEST_SUCCESS;
 
@@ -284,6 +290,9 @@ preamble (cairo_test_context_t *ctx)
     if (cairo_test_is_target_enabled (ctx, "svg11") ||
 	cairo_test_is_target_enabled (ctx, "svg12"))
     {
+	cairo_test_status_t test_status;
+	char *filename;
+
 	if (status == CAIRO_TEST_UNTESTED)
 	    status = CAIRO_TEST_SUCCESS;
 
@@ -303,6 +312,16 @@ preamble (cairo_test_context_t *ctx)
     return status;
 }
 
+#else /* CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE || CAIRO_HAS_SVG_SURFACE */
+
+static cairo_test_status_t
+preamble (cairo_test_context_t *ctx)
+{
+    return CAIRO_TEST_UNTESTED;
+}
+
+#endif /* CAIRO_HAS_PS_SURFACE || CAIRO_HAS_PDF_SURFACE || CAIRO_HAS_SVG_SURFACE */
+
 CAIRO_TEST (create_for_stream,
 	    "Checks creating vector surfaces with user defined I/O\n",
 	    "stream", /* keywords */
-- 
2.6.4.442.g545299f
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.