[cairo] [PATCH 2/2] observer: Silence gcc warning

Andrea Canciani ranma42 at gmail.com
Sat Feb 11 06:11:17 PST 2012


GCC complains that:

cairo-surface-observer.c:289:26: warning: ignoring return value of
'cairo_device_acquire', declared with attribute warn_unused_result
[-Wunused-result]

Explain why it's safe to ignore it in a comment.
---
 src/cairo-surface-observer.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/cairo-surface-observer.c b/src/cairo-surface-observer.c
index 3ac0892..6d57bf6 100644
--- a/src/cairo-surface-observer.c
+++ b/src/cairo-surface-observer.c
@@ -286,7 +286,11 @@ static void
 _cairo_device_observer_lock (void *_device)
 {
     cairo_device_observer_t *device = (cairo_device_observer_t *) _device;
-    cairo_device_acquire (device->target);
+    cairo_status_t ignored;
+
+    /* cairo_device_acquire() can fail for nil and finished
+     * devices. We don't care about observing them. */
+    ignored = cairo_device_acquire (device->target);
 }
 
 static void
-- 
1.7.5.4



More information about the cairo mailing list