require semi at the end of SkASSERT and friends
R=bungeman@google.com
TBR=reed@google.com
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2185063002
Review-Url: https://codereview.chromium.org/2185063002
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index deb2819..69c53c3 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -139,14 +139,19 @@
SK_API void SkDebugf(const char format[], ...);
#endif
-#define SkASSERT_RELEASE(cond) if (!(cond)) { SK_ABORT(#cond); }
+#define SkREQUIRE_SEMICOLON_AFTER(code) do { code } while (false)
+
+#define SkASSERT_RELEASE(cond) \
+ SkREQUIRE_SEMICOLON_AFTER(if (!(cond)) { SK_ABORT(#cond); } )
#ifdef SK_DEBUG
- #define SkASSERT(cond) if (!(cond)) { SK_ABORT("assert(" #cond ")"); }
- #define SkASSERTF(cond, fmt, ...) if (!(cond)) { \
- SkDebugf(fmt"\n", __VA_ARGS__); \
- SK_ABORT("assert(" #cond ")"); \
- }
+ #define SkASSERT(cond) \
+ SkREQUIRE_SEMICOLON_AFTER(if (!(cond)) { SK_ABORT("assert(" #cond ")"); })
+ #define SkASSERTF(cond, fmt, ...) \
+ SkREQUIRE_SEMICOLON_AFTER(if (!(cond)) { \
+ SkDebugf(fmt"\n", __VA_ARGS__); \
+ SK_ABORT("assert(" #cond ")"); \
+ })
#define SkDEBUGFAIL(message) SK_ABORT(message)
#define SkDEBUGFAILF(fmt, ...) SkASSERTF(false, fmt, ##__VA_ARGS__)
#define SkDEBUGCODE(code) code