From d6562000efca50bc2bfddae8dcb69dce6b8c0950 Mon Sep 17 00:00:00 2001 From: caryclark Date: Wed, 27 Jul 2016 12:02:07 -0700 Subject: [PATCH] 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 --- include/core/SkTypes.h | 17 +++++++++++------ include/gpu/GrClip.h | 4 ++-- src/core/SkLinearBitmapPipeline_sample.h | 2 +- src/core/SkNormalSource.cpp | 2 +- src/gpu/GrPathRenderer.h | 2 +- src/gpu/GrSoftwarePathRenderer.cpp | 2 +- src/gpu/GrStyle.cpp | 2 +- src/gpu/batches/GrAAStrokeRectBatch.cpp | 4 ++-- src/gpu/batches/GrPLSPathRenderer.cpp | 2 +- src/gpu/gl/GrGLGpu.cpp | 2 +- src/gpu/vk/GrVkMemory.cpp | 2 +- src/pathops/SkOpCoincidence.h | 8 ++++---- src/pathops/SkPathOpsDebug.cpp | 2 +- 13 files changed, 28 insertions(+), 23 deletions(-) diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h index deb2819740..69c53c3349 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 diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h index 1cb1a2bcf6..c74d25d77a 100644 --- a/include/gpu/GrClip.h +++ b/include/gpu/GrClip.h @@ -44,7 +44,7 @@ public: fHasStencilClip = true; if (deviceBounds) { fDeviceBounds = *deviceBounds; - SkASSERT(scissor.contains(*deviceBounds)) + SkASSERT(scissor.contains(*deviceBounds)); } else { fDeviceBounds = SkRect::Make(scissor); } @@ -75,7 +75,7 @@ public: fHasStencilClip = false; if (deviceBounds) { fDeviceBounds = *deviceBounds; - SkASSERT(scissor.contains(*deviceBounds)) + SkASSERT(scissor.contains(*deviceBounds)); } else { fDeviceBounds = SkRect::Make(scissor); } diff --git a/src/core/SkLinearBitmapPipeline_sample.h b/src/core/SkLinearBitmapPipeline_sample.h index 20057cc992..78f46ff797 100644 --- a/src/core/SkLinearBitmapPipeline_sample.h +++ b/src/core/SkLinearBitmapPipeline_sample.h @@ -445,7 +445,7 @@ private: // on the interval [0, vMax]. // Note: vMax is not width or height, but width-1 or height-1 because it is the largest valid pixel. static inline int adjust_edge(SkShader::TileMode edgeType, int vs, int vMax) { - SkASSERT(-1 <= vs && vs <= vMax + 1) + SkASSERT(-1 <= vs && vs <= vMax + 1); switch (edgeType) { case SkShader::kClamp_TileMode: case SkShader::kMirror_TileMode: diff --git a/src/core/SkNormalSource.cpp b/src/core/SkNormalSource.cpp index c282a124e0..38cf0bf0af 100644 --- a/src/core/SkNormalSource.cpp +++ b/src/core/SkNormalSource.cpp @@ -280,7 +280,7 @@ void NormalMapSourceImpl::Provider::fillScanLine(int x, int y, SkPoint3 output[] output[i].normalize(); } - SkASSERT(SkScalarNearlyEqual(output[i].length(), 1.0f)) + SkASSERT(SkScalarNearlyEqual(output[i].length(), 1.0f)); } output += n; diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h index 6547a41843..52ecc59075 100644 --- a/src/gpu/GrPathRenderer.h +++ b/src/gpu/GrPathRenderer.h @@ -196,7 +196,7 @@ public: SkASSERT(fDrawContext); SkASSERT(fViewMatrix); SkASSERT(fShape); - SkASSERT(fShape->style().isSimpleFill()) + SkASSERT(fShape->style().isSimpleFill()); SkPath path; fShape->asPath(&path); SkASSERT(!path.isInverseFillType()); diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp index 2728811bc9..05b3ef8853 100644 --- a/src/gpu/GrSoftwarePathRenderer.cpp +++ b/src/gpu/GrSoftwarePathRenderer.cpp @@ -130,7 +130,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) { // We really need to know if the shape will be inverse filled or not bool inverseFilled = false; SkTLazy tmpShape; - SkASSERT(!args.fShape->style().applies()) + SkASSERT(!args.fShape->style().applies()); inverseFilled = args.fShape->inverseFilled(); SkIRect devShapeBounds, devClipBounds; diff --git a/src/gpu/GrStyle.cpp b/src/gpu/GrStyle.cpp index 7ea5193b35..153cade919 100644 --- a/src/gpu/GrStyle.cpp +++ b/src/gpu/GrStyle.cpp @@ -104,7 +104,7 @@ void GrStyle::WriteKey(uint32_t *key, const GrStyle &style, Apply apply, SkScala } void GrStyle::initPathEffect(SkPathEffect* pe) { - SkASSERT(!fPathEffect) + SkASSERT(!fPathEffect); SkASSERT(SkPathEffect::kNone_DashType == fDashInfo.fType); SkASSERT(0 == fDashInfo.fIntervals.count()); if (!pe) { diff --git a/src/gpu/batches/GrAAStrokeRectBatch.cpp b/src/gpu/batches/GrAAStrokeRectBatch.cpp index 8c42c9a039..bbee3f878a 100644 --- a/src/gpu/batches/GrAAStrokeRectBatch.cpp +++ b/src/gpu/batches/GrAAStrokeRectBatch.cpp @@ -124,8 +124,8 @@ public: const SkRect& devOutside, const SkRect& devInside) : INHERITED(ClassID()) , fViewMatrix(viewMatrix) { - SkASSERT(!devOutside.isEmpty()) - SkASSERT(!devInside.isEmpty()) + SkASSERT(!devOutside.isEmpty()); + SkASSERT(!devInside.isEmpty()); fGeoData.emplace_back(Geometry{color, devOutside, devOutside, devInside, false}); this->setBounds(devOutside, HasAABloat::kYes, IsZeroArea::kNo); diff --git a/src/gpu/batches/GrPLSPathRenderer.cpp b/src/gpu/batches/GrPLSPathRenderer.cpp index ad9bde1cfb..c022e1642c 100644 --- a/src/gpu/batches/GrPLSPathRenderer.cpp +++ b/src/gpu/batches/GrPLSPathRenderer.cpp @@ -942,7 +942,7 @@ private: SkDEBUGCODE(bool inPLSDraw = false;) bool GrPLSPathRenderer::onDrawPath(const DrawPathArgs& args) { - SkASSERT(!args.fShape->isEmpty()) + SkASSERT(!args.fShape->isEmpty()); SkASSERT(!inPLSDraw); SkDEBUGCODE(inPLSDraw = true;) SkPath path; diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index d309dc1b93..ec38804da3 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -2769,7 +2769,7 @@ void GrGLGpu::draw(const GrPipeline& pipeline, } void GrGLGpu::stampPLSSetupRect(const SkRect& bounds) { - SkASSERT(this->glCaps().glslCaps()->plsPathRenderingSupport()) + SkASSERT(this->glCaps().glslCaps()->plsPathRenderingSupport()); if (!fPLSSetupProgram.fProgram) { if (!this->createPLSSetupProgram()) { diff --git a/src/gpu/vk/GrVkMemory.cpp b/src/gpu/vk/GrVkMemory.cpp index 63cb52355d..19150c62a7 100644 --- a/src/gpu/vk/GrVkMemory.cpp +++ b/src/gpu/vk/GrVkMemory.cpp @@ -297,7 +297,7 @@ bool GrVkFreeListAlloc::alloc(VkDeviceSize requestedSize, } iter.next(); } - SkASSERT(largestSize == fLargestBlockSize) + SkASSERT(largestSize == fLargestBlockSize); #endif } else { SkASSERT(bestFit->fSize == alignedSize); diff --git a/src/pathops/SkOpCoincidence.h b/src/pathops/SkOpCoincidence.h index 9835a21404..4b3e4726ab 100644 --- a/src/pathops/SkOpCoincidence.h +++ b/src/pathops/SkOpCoincidence.h @@ -72,7 +72,7 @@ public: SkDEBUGPARAMS(int id)); void setCoinPtTEnd(const SkOpPtT* ptT) { - SkOPASSERT(ptT == ptT->span()->ptT()) + SkOPASSERT(ptT == ptT->span()->ptT()); SkASSERT(!fCoinPtTStart || ptT->fT != fCoinPtTStart->fT); SkASSERT(!fCoinPtTStart || fCoinPtTStart->segment() == ptT->segment()); fCoinPtTEnd = ptT; @@ -80,7 +80,7 @@ public: } void setCoinPtTStart(const SkOpPtT* ptT) { - SkASSERT(ptT == ptT->span()->ptT()) + SkASSERT(ptT == ptT->span()->ptT()); SkASSERT(!fCoinPtTEnd || ptT->fT != fCoinPtTEnd->fT); SkASSERT(!fCoinPtTEnd || fCoinPtTEnd->segment() == ptT->segment()); fCoinPtTStart = ptT; @@ -93,7 +93,7 @@ public: } void setOppPtTEnd(const SkOpPtT* ptT) { - SkOPASSERT(ptT == ptT->span()->ptT()) + SkOPASSERT(ptT == ptT->span()->ptT()); SkASSERT(!fOppPtTStart || ptT->fT != fOppPtTStart->fT); SkASSERT(!fOppPtTStart || fOppPtTStart->segment() == ptT->segment()); fOppPtTEnd = ptT; @@ -101,7 +101,7 @@ public: } void setOppPtTStart(const SkOpPtT* ptT) { - SkASSERT(ptT == ptT->span()->ptT()) + SkASSERT(ptT == ptT->span()->ptT()); SkASSERT(!fOppPtTEnd || ptT->fT != fOppPtTEnd->fT); SkASSERT(!fOppPtTEnd || fOppPtTEnd->segment() == ptT->segment()); fOppPtTStart = ptT; diff --git a/src/pathops/SkPathOpsDebug.cpp b/src/pathops/SkPathOpsDebug.cpp index 93743f3d6c..b839feeadb 100644 --- a/src/pathops/SkPathOpsDebug.cpp +++ b/src/pathops/SkPathOpsDebug.cpp @@ -822,7 +822,7 @@ void SkOpSegment::debugMissingCoincidence(const char* id, SkPathOpsDebug::Glitch // coincidences->add(rootPriorPtT, rootPtT, rootOppStart, rootOppEnd); // } #if DEBUG_COINCIDENCE -// SkASSERT(coincidences->contains(rootPriorPtT, rootPtT, rootOppStart, rootOppEnd) +// SkASSERT(coincidences->contains(rootPriorPtT, rootPtT, rootOppStart, rootOppEnd); #endif // result = true; }