No error if function marked with SK_WARN_UNUSED_RESULT is used in SkAssertResult
authorbsalomon <bsalomon@google.com>
Mon, 9 May 2016 16:14:36 +0000 (09:14 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 9 May 2016 16:14:36 +0000 (09:14 -0700)
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1955263002

Review-Url: https://codereview.chromium.org/1955263002

include/core/SkTypes.h

index f99bb01..b44df0d 100644 (file)
@@ -148,8 +148,9 @@ inline void operator delete(void* p) {
     #define SkDECLAREPARAM(type, var)
     #define SkPARAM(var)
 
-    // unlike SkASSERT, this guy executes its condition in the non-debug build
-    #define SkAssertResult(cond)        cond
+    // unlike SkASSERT, this guy executes its condition in the non-debug build.
+    // It casts to void to allow use with functions declared with SK_WARN_RESULT_UNUSED.
+    #define SkAssertResult(cond)        (void)(cond)
 #endif
 
 // Legacy macro names for SK_ABORT