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

Side by Side Diff: include/core/SkTypes.h

Issue 1962723003: Make SkAssertResult work with SK_WARN_UNUSED_RESULT in Release on gcc (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | no next file » | 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 #define SkAssertResult(cond) SkASSERT(cond) 142 #define SkAssertResult(cond) SkASSERT(cond)
143 #else 143 #else
144 #define SkASSERT(cond) 144 #define SkASSERT(cond)
145 #define SkDEBUGFAIL(message) 145 #define SkDEBUGFAIL(message)
146 #define SkDEBUGCODE(code) 146 #define SkDEBUGCODE(code)
147 #define SkDEBUGF(args) 147 #define SkDEBUGF(args)
148 #define SkDECLAREPARAM(type, var) 148 #define SkDECLAREPARAM(type, var)
149 #define SkPARAM(var) 149 #define SkPARAM(var)
150 150
151 // unlike SkASSERT, this guy executes its condition in the non-debug build. 151 // unlike SkASSERT, this guy executes its condition in the non-debug build.
152 // It casts to void to allow use with functions declared with SK_WARN_RESULT _UNUSED. 152 // The if is present so that this can be used with functions marked SK_WARN_ UNUSED_RESULT.
153 #define SkAssertResult(cond) (void)(cond) 153 #define SkAssertResult(cond) if (cond) {} do {} while(false)
154 #endif 154 #endif
155 155
156 // Legacy macro names for SK_ABORT 156 // Legacy macro names for SK_ABORT
157 #define SkFAIL(message) SK_ABORT(message) 157 #define SkFAIL(message) SK_ABORT(message)
158 #define sk_throw() SK_ABORT("sk_throw") 158 #define sk_throw() SK_ABORT("sk_throw")
159 159
160 // We want to evaluate cond only once, and inside the SkASSERT somewhere so we s ee its string form. 160 // We want to evaluate cond only once, and inside the SkASSERT somewhere so we s ee its string form.
161 // So we use the comma operator to make an SkDebugf that always returns false: w e'll evaluate cond, 161 // So we use the comma operator to make an SkDebugf that always returns false: w e'll evaluate cond,
162 // and if it's true the assert passes; if it's false, we'll print the message an d the assert fails. 162 // and if it's true the assert passes; if it's false, we'll print the message an d the assert fails.
163 #define SkASSERTF(cond, fmt, ...) SkASSERT((cond) || (SkDebugf(fmt"\n", __ VA_ARGS__), false)) 163 #define SkASSERTF(cond, fmt, ...) SkASSERT((cond) || (SkDebugf(fmt"\n", __ VA_ARGS__), false))
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 701
702 void* fPtr; 702 void* fPtr;
703 size_t fSize; // can be larger than the requested size (see kReuse) 703 size_t fSize; // can be larger than the requested size (see kReuse)
704 uint32_t fStorage[kSize >> 2]; 704 uint32_t fStorage[kSize >> 2];
705 }; 705 };
706 // Can't guard the constructor because it's a template class. 706 // Can't guard the constructor because it's a template class.
707 707
708 #endif /* C++ */ 708 #endif /* C++ */
709 709
710 #endif 710 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698