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

Side by Side 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, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | include/gpu/GrClip.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkTypes_DEFINED 8 #ifndef SkTypes_DEFINED
9 #define SkTypes_DEFINED 9 #define SkTypes_DEFINED
10 10
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 #endif 132 #endif
133 133
134 /////////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////////
135 135
136 #define SK_INIT_TO_AVOID_WARNING = 0 136 #define SK_INIT_TO_AVOID_WARNING = 0
137 137
138 #ifndef SkDebugf 138 #ifndef SkDebugf
139 SK_API void SkDebugf(const char format[], ...); 139 SK_API void SkDebugf(const char format[], ...);
140 #endif 140 #endif
141 141
142 #define SkASSERT_RELEASE(cond) if (!(cond)) { SK_ABORT(#cond); } 142 #define SkREQUIRE_SEMICOLON_AFTER(code) do { code } while (false)
143
144 #define SkASSERT_RELEASE(cond) \
145 SkREQUIRE_SEMICOLON_AFTER(if (!(cond)) { SK_ABORT(#cond); } )
143 146
144 #ifdef SK_DEBUG 147 #ifdef SK_DEBUG
145 #define SkASSERT(cond) if (!(cond)) { SK_ABORT("assert(" #cond ")"); } 148 #define SkASSERT(cond) \
146 #define SkASSERTF(cond, fmt, ...) if (!(cond)) { \ 149 SkREQUIRE_SEMICOLON_AFTER(if (!(cond)) { SK_ABORT("assert(" #cond ")"); })
147 SkDebugf(fmt"\n", __VA_ARGS__); \ 150 #define SkASSERTF(cond, fmt, ...) \
148 SK_ABORT("assert(" #cond ")"); \ 151 SkREQUIRE_SEMICOLON_AFTER(if (!(cond)) { \
149 } 152 SkDebugf(fmt"\n", __VA_ARGS__); \
153 SK_ABORT("assert(" #cond ")"); \
154 })
150 #define SkDEBUGFAIL(message) SK_ABORT(message) 155 #define SkDEBUGFAIL(message) SK_ABORT(message)
151 #define SkDEBUGFAILF(fmt, ...) SkASSERTF(false, fmt, ##__VA_ARGS__) 156 #define SkDEBUGFAILF(fmt, ...) SkASSERTF(false, fmt, ##__VA_ARGS__)
152 #define SkDEBUGCODE(code) code 157 #define SkDEBUGCODE(code) code
153 #define SkDECLAREPARAM(type, var) , type var 158 #define SkDECLAREPARAM(type, var) , type var
154 #define SkPARAM(var) , var 159 #define SkPARAM(var) , var
155 #define SkDEBUGF(args ) SkDebugf args 160 #define SkDEBUGF(args ) SkDebugf args
156 #define SkAssertResult(cond) SkASSERT(cond) 161 #define SkAssertResult(cond) SkASSERT(cond)
157 #else 162 #else
158 #define SkASSERT(cond) 163 #define SkASSERT(cond)
159 #define SkASSERTF(cond, fmt, ...) 164 #define SkASSERTF(cond, fmt, ...)
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 720
716 void* fPtr; 721 void* fPtr;
717 size_t fSize; // can be larger than the requested size (see kReuse) 722 size_t fSize; // can be larger than the requested size (see kReuse)
718 uint32_t fStorage[kSize >> 2]; 723 uint32_t fStorage[kSize >> 2];
719 }; 724 };
720 // Can't guard the constructor because it's a template class. 725 // Can't guard the constructor because it's a template class.
721 726
722 #endif /* C++ */ 727 #endif /* C++ */
723 728
724 #endif 729 #endif
OLDNEW
« 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