[cairo-commit] src/cairo-mutex-impl-private.h
Jeff Muizelaar
jrmuizel at kemper.freedesktop.org
Wed Jan 28 14:18:02 PST 2009
src/cairo-mutex-impl-private.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit f4ff6128d7fb6e4b5ba361a597fc6c0c88d5ec00
Author: Jeff Muizelaar <jmuizelaar at mozilla.com>
Date: Wed Jan 28 17:16:32 2009 -0500
Avoid "empty body in an if-statement" warning
Use '(void)expr;' instead of 'if (expr) ;' to avoid getting the warning.
'if (expr) {}' is an option, however '(void)expr;' seems like a more common
idiom and getting warnings for __attribute__((warn_unsed_result)) functions is
probably prefered.
diff --git a/src/cairo-mutex-impl-private.h b/src/cairo-mutex-impl-private.h
index 239dbbb..ad65c11 100644
--- a/src/cairo-mutex-impl-private.h
+++ b/src/cairo-mutex-impl-private.h
@@ -54,8 +54,9 @@
/* A fully qualified no-operation statement */
#define CAIRO_MUTEX_IMPL_NOOP do {/*no-op*/} while (0)
/* And one that evaluates it's argument once */
-#define CAIRO_MUTEX_IMPL_NOOP1(expr) do { if (expr) ; } while (0)
-
+#define CAIRO_MUTEX_IMPL_NOOP1(expr) do { (void)(expr); } while (0)
+/* NOTE: 'if (expr) {}' is an alternative to '(void)(expr);' that will 'use' the
+ * result of __attribute__((warn_used_result)) functions. */
/* Cairo mutex implementation:
*
More information about the cairo-commit
mailing list