Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: include/core/SkTypes.h

Issue 2185063002: require semi at the end of SkASSERT and friends (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: refactor do while as macro Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/gpu/GrClip.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTypes.h
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index deb281974058c8a0e4435b2e93497c4194ce5ed9..69c53c33491a70576c27890723fbf7f261a00c02 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -139,14 +139,19 @@ inline void operator delete(void* p) {
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
« no previous file with comments | « no previous file | include/gpu/GrClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698