#define MOJO_WARN_UNUSED_RESULT
#endif
+#ifdef __cplusplus
+// Used to explicitly mark the return value of a function as unused. If you are
+// really sure you don't want to do anything with the return value of a function
+// that has been marked WARN_UNUSED_RESULT, wrap it with this. Example:
+//
+// scoped_ptr<MyType> my_var = ...;
+// if (TakeOwnership(my_var.get()) == SUCCESS)
+// mojo_ignore_result(my_var.release());
+//
+template <typename T>
+inline void mojo_ignore_result(const T&) {
+}
+#endif
+
// Assert things at compile time. (|msg| should be a valid identifier name.)
// This macro is currently C++-only, but we want to use it in the C core.h.
// Use like:
#if __cplusplus >= 201103L
#define MOJO_COMPILE_ASSERT(expr, msg) static_assert(expr, #msg)
#elif defined(__cplusplus)
-namespace mojo { template <bool> struct CompileAssert {}; }
+namespace mojo {
+template <bool>
+struct CompileAssert {};
+}
#define MOJO_COMPILE_ASSERT(expr, msg) \
- typedef ::mojo::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
+ typedef ::mojo::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
#else
#define MOJO_COMPILE_ASSERT(expr, msg)
#endif