Fix implicit fallthroughs throughout Skia.

This CL is not fully comprehensive; for instance, it does not contain
fixes for backends that don't compile on Mac. But it does resolve the
vast majority of cases that trigger -Wimplicit-fallthrough.

A few minor bugs were found and fixed, but none that were likely to
affect normal operation.

Change-Id: I43487602b0d56200ce8b42702e04f66390d82f60
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/295916
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2020-06-11 17:55:07 -04:00 committed by Skia Commit-Bot
parent 77968f0d32
commit 30212b7941
53 changed files with 303 additions and 204 deletions

View File

@ -512,7 +512,7 @@ Result CodecSrc::draw(SkCanvas* canvas) const {
return Result::Skip(
"Cannot decode frame %i to 565 (%s).", i, fPath.c_str());
}
// Fall through.
[[fallthrough]];
default:
return Result::Fatal(
"Couldn't getPixels for frame %i in %s.", i, fPath.c_str());

View File

@ -464,6 +464,7 @@ static void fuzz_img(sk_sp<SkData> bytes, uint8_t scale, uint8_t mode) {
SkDebugf("Incompatible colortype conversion\n");
// Crash to allow afl-fuzz to know this was a bug.
raise(SIGSEGV);
break;
default:
SkDebugf("[terminated] Couldn't getPixels.\n");
return;
@ -594,7 +595,7 @@ static void fuzz_img(sk_sp<SkData> bytes, uint8_t scale, uint8_t mode) {
return;
}
// If the first subset succeeded, a later one should not fail.
// fall through to failure
[[fallthrough]];
case SkCodec::kUnimplemented:
if (0 == (x|y)) {
// First subset is okay to return unimplemented.
@ -602,7 +603,7 @@ static void fuzz_img(sk_sp<SkData> bytes, uint8_t scale, uint8_t mode) {
return;
}
// If the first subset succeeded, why would a later one fail?
// fall through to failure
[[fallthrough]];
default:
SkDebugf("[terminated] subset codec failed to decode (%d, %d, %d, %d) "
"with dimensions (%d x %d)\t error %d\n",

View File

@ -100,6 +100,7 @@ protected:
SkFont font(ToolUtils::create_portable_typeface(), 100);
font.setEmbolden(true);
canvas->drawString(text, 0.f, 100.f, font, *paint);
break;
}
default:
break;

View File

@ -154,7 +154,7 @@ class XfermodesGM : public skiagm::GM {
canvas->saveLayer(&bounds, &p);
restoreNeeded = true;
p.setBlendMode(SkBlendMode::kSrcOver);
// Fall through.
[[fallthrough]];
}
case kQuarterClear_SrcType: {
SkScalar halfW = SkIntToScalar(W) / 2;
@ -175,7 +175,7 @@ class XfermodesGM : public skiagm::GM {
SkScalar h = SkIntToScalar(H);
SkRect r = SkRect::MakeXYWH(x, y + h / 4, w, h * 23 / 60);
canvas->clipRect(r);
// Fall through.
[[fallthrough]];
}
case kRectangle_SrcType: {
SkScalar w = SkIntToScalar(W);
@ -188,10 +188,10 @@ class XfermodesGM : public skiagm::GM {
}
case kSmallRectangleImageWithAlpha_SrcType:
m.postScale(SK_ScalarHalf, SK_ScalarHalf, x, y);
// Fall through.
[[fallthrough]];
case kRectangleImageWithAlpha_SrcType:
p.setAlpha(0x88);
// Fall through.
[[fallthrough]];
case kRectangleImage_SrcType: {
SkAutoCanvasRestore acr(canvas, true);
canvas->concat(m);

View File

@ -1055,8 +1055,12 @@ void ParagraphImpl::setState(InternalState state) {
fBidiRegions.reset();
fGraphemes16.reset();
fCodepoints.reset();
[[fallthrough]];
case kShaped:
fClusters.reset();
[[fallthrough]];
case kClusterized:
case kMarked:
case kLineBroken:
@ -1065,12 +1069,15 @@ void ParagraphImpl::setState(InternalState state) {
this->computeEmptyMetrics();
this->resetShifts();
fLines.reset();
[[fallthrough]];
case kFormatted:
fPicture = nullptr;
[[fallthrough]];
case kDrawn:
default:
break;
default:
break;
}
}

View File

@ -278,6 +278,7 @@ static void set_path_verb(int index, SkPath::Verb v, SkPath* path, SkScalar w) {
switch (v) {
case SkPath::kConic_Verb:
weight = w;
[[fallthrough]];
case SkPath::kQuad_Verb:
pts[2] = pts[1];
pts[1].fX = (pts[0].fX + pts[2].fX) / 2;
@ -303,6 +304,7 @@ static void set_path_verb(int index, SkPath::Verb v, SkPath* path, SkScalar w) {
break;
case SkPath::kConic_Verb:
weight = w;
[[fallthrough]];
case SkPath::kQuad_Verb:
break;
case SkPath::kCubic_Verb: {
@ -325,6 +327,7 @@ static void set_path_verb(int index, SkPath::Verb v, SkPath* path, SkScalar w) {
break;
case SkPath::kConic_Verb:
weight = w;
[[fallthrough]];
case SkPath::kQuad_Verb: {
SkDCubic dCubic;
dCubic.set(pts);

View File

@ -104,11 +104,10 @@ class SampleAnimatedImage : public Sample {
switch (uni) {
case kPauseKey:
fRunning = !fRunning;
if (fImage->isFinished()) {
// fall through
} else {
if (!fImage->isFinished()) {
return true;
}
[[fallthrough]];
case kResetKey:
fImage->reset();
fCurrentTime = fLastWallTime;

View File

@ -394,7 +394,7 @@ SkCodec::Result SkBmpCodec::ReadHeader(SkStream* stream, bool inIco,
inputFormat = kRLE_BmpInputFormat;
break;
}
// Fall through
[[fallthrough]];
case kPng_BmpCompressionMethod:
// TODO: Decide if we intend to support this.
// It is unsupported in the previous version and

View File

@ -1018,8 +1018,7 @@ SkCodec::Result SkPngCodec::initializeXforms(const SkImageInfo& dstInfo, const O
if (this->getEncodedInfo().bitsPerComponent() != 16) {
break;
}
// Fall through
[[fallthrough]];
case SkEncodedInfo::kRGBA_Color:
case SkEncodedInfo::kGray_Color:
skipFormatConversion = this->colorXform();

View File

@ -143,7 +143,7 @@ std::unique_ptr<SkCodec> SkWebpCodec::MakeFromStream(std::unique_ptr<SkStream> s
// sense to guess kBGRA which is likely closer to the final
// output. Otherwise, we might end up converting
// BGRA->YUVA->BGRA.
// Fallthrough:
[[fallthrough]];
case 2:
// This is the lossless format (BGRA).
if (hasAlpha) {

View File

@ -64,7 +64,7 @@ static void decal_nofilter_scale(uint32_t dst[], SkFixed fx, SkFixed dx, int cou
SkASSERT(count <= 2);
switch (count) {
case 2: ((uint16_t*)dst)[1] = SkToU16((fx + dx) >> 16);
case 2: ((uint16_t*)dst)[1] = SkToU16((fx + dx) >> 16); [[fallthrough]];
case 1: ((uint16_t*)dst)[0] = SkToU16((fx + 0) >> 16);
}
}
@ -475,7 +475,7 @@ SkBitmapProcState::MatrixProc SkBitmapProcState::chooseMatrixProc(bool translate
// Check for our special case translate methods when there is no scale/affine/perspective.
if (translate_only_matrix && kNone_SkFilterQuality == fFilterQuality) {
switch (fTileModeX) {
default: SkASSERT(false);
default: SkASSERT(false); [[fallthrough]];
case SkTileMode::kClamp: return clampx_nofilter_trans<int_clamp>;
case SkTileMode::kRepeat: return repeatx_nofilter_trans<int_repeat>;
case SkTileMode::kMirror: return mirrorx_nofilter_trans<int_mirror>;

View File

@ -436,7 +436,7 @@ SkBlurMaskFilterImpl::filterRRectToNine(const SkRRect& rrect, const SkMatrix& ma
case SkRRect::kRect_Type:
// We should have caught this earlier.
SkASSERT(false);
// Fall through.
[[fallthrough]];
case SkRRect::kOval_Type:
// The nine patch special case does not handle ovals, and we
// already have code for rectangles.

View File

@ -392,7 +392,7 @@ void SkClipStack::Element::combineBoundsXOR(int combination, const SkRect& prevF
// The only pixels that can survive are within the
// union of the two bounding boxes since the extensions
// to infinity of both clips cancel out
// fall through!
[[fallthrough]];
case kPrev_Cur_FillCombo:
// The most conservative bound for xor is the
// union of the two bounds. If the two clips exactly overlapped
@ -830,7 +830,7 @@ void SkClipStack::pushElement(const Element& element) {
}
break;
}
// fallthrough
[[fallthrough]];
default:
if (!SkRect::Intersects(prior->getBounds(), element.getBounds())) {
prior->setEmpty();

View File

@ -511,7 +511,7 @@ void SkDraw::drawPoints(SkCanvas::PointMode mode, size_t count,
break;
}
}
// couldn't take fast path so fall through!
[[fallthrough]]; // couldn't take fast path
case SkCanvas::kPolygon_PointMode: {
count -= 1;
SkPath path;

View File

@ -90,7 +90,7 @@ bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType,
if (kUnpremul_SkAlphaType == alphaType) {
alphaType = kPremul_SkAlphaType;
}
// fall-through
[[fallthrough]];
case kARGB_4444_SkColorType:
case kRGBA_8888_SkColorType:
case kBGRA_8888_SkColorType:

View File

@ -255,7 +255,7 @@ bool SkMaskFilterBase::filterPath(const SkPath& devPath, const SkMatrix& matrix,
case kUnimplemented_FilterReturn:
SkASSERT(nullptr == patch.fMask.fImage);
// fall through
// fall out
break;
}
}

View File

@ -44,6 +44,7 @@ uint32_t SkModeColorFilter::getFlags() const {
case SkBlendMode::kDst: //!< [Da, Dc]
case SkBlendMode::kSrcATop: //!< [Da, Sc * Da + (1 - Sa) * Dc]
flags |= kAlphaUnchanged_Flag;
break;
default:
break;
}

View File

@ -1815,7 +1815,7 @@ SkPath::Verb SkPath::Iter::next(SkPoint ptsParam[4]) {
break;
case kConic_Verb:
fConicWeights += 1;
// fall-through
[[fallthrough]];
case kQuad_Verb:
pts[0] = this->cons_moveTo();
memcpy(&pts[1], srcPts, 2 * sizeof(SkPoint));
@ -2351,7 +2351,7 @@ void ContourIter::next() {
break;
case SkPath::kConic_Verb:
fCurrConicWeight += 1;
// fall-through
[[fallthrough]];
case SkPath::kQuad_Verb:
ptCount += 2;
break;
@ -3348,6 +3348,7 @@ bool SkPathPriv::IsRectContour(const SkPath& path, bool allowPartial, int* currV
savePts = pts;
autoClose = true;
insertClose = false;
[[fallthrough]];
case SkPath::kLine_Verb: {
if (SkPath::kClose_Verb != verb) {
lastPt = pts;

View File

@ -394,10 +394,12 @@ SkPoint* SkPathRef::growForRepeatedVerb(int /*SkPath::Verb*/ verb,
break;
case SkPath::kDone_Verb:
SkDEBUGFAIL("growForRepeatedVerb called for kDone");
// fall through
pCnt = 0;
break;
default:
SkDEBUGFAIL("default should not be reached");
pCnt = 0;
break;
}
fBoundsIsDirty = true; // this also invalidates fIsFinite
@ -444,10 +446,12 @@ SkPoint* SkPathRef::growForVerb(int /* SkPath::Verb*/ verb, SkScalar weight) {
break;
case SkPath::kDone_Verb:
SkDEBUGFAIL("growForVerb called for kDone");
// fall through
pCnt = 0;
break;
default:
SkDEBUGFAIL("default is not reached");
pCnt = 0;
break;
}
fSegmentMask |= mask;
@ -596,7 +600,7 @@ uint8_t SkPathRef::Iter::next(SkPoint pts[4]) {
break;
case SkPath::kConic_Verb:
fConicWeights += 1;
// fall-through
[[fallthrough]];
case SkPath::kQuad_Verb:
pts[0] = srcPts[-1];
pts[1] = srcPts[0];

View File

@ -211,7 +211,7 @@ size_t SkPath::readFromMemory_EQ4Or5(const void* storage, size_t length) {
case SerializationType::kRRect:
return this->readAsRRect(storage, length);
case SerializationType::kGeneral:
break; // fall through
break; // fall out
default:
return 0;
}

View File

@ -185,7 +185,7 @@ sk_sp<SkPicture> SkPicture::MakeFromStream(SkStream* stream, const SkDeserialPro
}
return procs.fPictureProc(data->data(), size, procs.fPictureCtx);
}
default: // fall through to error return
default: // fall out to error return
break;
}
return nullptr;

View File

@ -1234,32 +1234,35 @@ namespace skvm {
};
switch (mode) {
default: SkASSERT(false); /*but also, for safety, fallthrough*/
default:
SkASSERT(false);
[[fallthrough]]; /*but also, for safety, fallthrough*/
case SkBlendMode::kClear: return { splat(0.0f), splat(0.0f), splat(0.0f), splat(0.0f) };
case SkBlendMode::kSrc: return src;
case SkBlendMode::kDst: return dst;
case SkBlendMode::kDstOver: std::swap(src, dst); // fall-through
case SkBlendMode::kDstOver: std::swap(src, dst); [[fallthrough]];
case SkBlendMode::kSrcOver:
return apply_rgba([&](auto s, auto d) {
return mad(d,1-src.a, s);
});
case SkBlendMode::kDstIn: std::swap(src, dst); // fall-through
case SkBlendMode::kDstIn: std::swap(src, dst); [[fallthrough]];
case SkBlendMode::kSrcIn:
return apply_rgba([&](auto s, auto d) {
return s * dst.a;
});
case SkBlendMode::kDstOut: std::swap(src, dst); // fall-through
case SkBlendMode::kDstOut: std::swap(src, dst); [[fallthrough]];
case SkBlendMode::kSrcOut:
return apply_rgba([&](auto s, auto d) {
return s * (1-dst.a);
});
case SkBlendMode::kDstATop: std::swap(src, dst); // fall-through
case SkBlendMode::kDstATop: std::swap(src, dst); [[fallthrough]];
case SkBlendMode::kSrcATop:
return apply_rgba([&](auto s, auto d) {
return mma(s, dst.a, d, 1-src.a);

View File

@ -127,7 +127,7 @@ static void morphpath(SkPath* dst, const SkPath& src, SkPathMeasure& meas,
srcP[2] = srcP[1];
srcP[1].set(SkScalarAve(srcP[0].fX, srcP[2].fX),
SkScalarAve(srcP[0].fY, srcP[2].fY));
// fall through to quad
[[fallthrough]];
case SkPath::kQuad_Verb:
if (morphpoints(dstP, &srcP[1], 2, meas, dist)) {
dst->quadTo(dstP[0], dstP[1]);

View File

@ -358,9 +358,11 @@ GrCaps::SupportedRead GrCaps::supportedReadPixelsColorType(GrColorType srcColorT
// offset alignment is a multiple of 2 but not 4.
case 2:
read.fOffsetAlignmentForTransferBuffer *= 2;
break;
// offset alignment is not a multiple of 2.
default:
read.fOffsetAlignmentForTransferBuffer *= 4;
break;
}
}
return read;

View File

@ -556,6 +556,7 @@ bool GrOpsTask::onExecute(GrOpFlushState* flushState) {
// once finished, meaning the stencil values will always remain cleared after the
// initial clear. Just fall through to reloading the existing (cleared) stencil values
// from memory.
[[fallthrough]];
case StencilContent::kPreserved:
SkASSERT(stencil);
stencilLoadOp = GrLoadOp::kLoad;

View File

@ -2400,13 +2400,13 @@ int get_contour_count(const SkPath& path, SkScalar tolerance) {
if (!first) {
++contourCnt;
}
// fallthru.
[[fallthrough]];
case SkPath::kLine_Verb:
case SkPath::kConic_Verb:
case SkPath::kQuad_Verb:
case SkPath::kCubic_Verb:
hasPoints = true;
// fallthru to break.
break;
default:
break;
}

View File

@ -433,7 +433,7 @@ bool GrCCFiller::prepareToDraw(GrOnFlushResourceProvider* onFlushRP) {
SkASSERT(!currFan.empty());
currFan.pop_back();
}
// fallthru.
[[fallthrough]];
case Verb::kEndOpenContour: // endPt != startPt.
SkASSERT(!currFanIsTessellated || currFan.empty());
if (!currFanIsTessellated && currFan.count() >= 3) {

View File

@ -649,10 +649,10 @@ bool GrCCStroker::prepareToDraw(GrOnFlushResourceProvider* onFlushRP) {
case Verb::kRoundJoin:
case Verb::kInternalRoundJoin:
conicWeight = params[paramsIdx++].fConicWeight;
// fallthru
[[fallthrough]];
case Verb::kMiterJoin:
miterCapHeightOverWidth = params[paramsIdx++].fMiterCapHeightOverWidth;
// fallthru
[[fallthrough]];
case Verb::kBevelJoin:
case Verb::kInternalBevelJoin:
builder.appendJoin(verb, pts[ptsIdx], normals[normalsIdx], normals[normalsIdx + 1],

View File

@ -136,7 +136,7 @@ GrPathRenderer::CanDrawPath GrCoverageCountingPathRenderer::onCanDrawPath(
// defined relative to device space.
return CanDrawPath::kNo;
}
// fallthru
[[fallthrough]];
case SkStrokeRec::kHairline_Style: {
if (CoverageType::kFP16_CoverageCount != fCoverageType) {
// Stroking is not yet supported in MSAA atlas mode.

View File

@ -130,6 +130,7 @@ std::unique_ptr<GrFragmentProcessor> GrConvexPolyEffect::Make(GrClipEdgeType typ
switch (verb) {
case SkPath::kMove_Verb:
SkASSERT(n == 0);
break;
case SkPath::kClose_Verb:
break;
case SkPath::kLine_Verb: {

View File

@ -762,6 +762,7 @@ std::unique_ptr<GrFragmentProcessor> GrRRectEffect::Make(GrClipEdgeType edgeType
// This rrect should have been caught in the simple case above. Though, it would
// be correctly handled in the fallthrough code.
SkASSERT(false);
[[fallthrough]];
case CircularRRectEffect::kTopLeft_CornerFlag:
case CircularRRectEffect::kTopRight_CornerFlag:
case CircularRRectEffect::kBottomRight_CornerFlag:

View File

@ -188,6 +188,7 @@ int GrPathUtils::worstCasePointCount(const SkPath& path, int* subpaths, SkScalar
for (int i = 0; i < converter.countQuads(); ++i) {
pointCount += quadraticPointCount(quadPts + 2*i, tol);
}
[[fallthrough]];
}
case SkPath::kQuad_Verb:
pointCount += quadraticPointCount(pts, tol);
@ -806,7 +807,7 @@ SkCubicType GrPathUtils::getCubicKLM(const SkPoint src[4], SkMatrix* klm, double
switch (type) {
case SkCubicType::kCuspAtInfinity:
SkASSERT(1 == t1 && 0 == s1); // Infinity.
// fallthru.
[[fallthrough]];
case SkCubicType::kLocalCusp:
case SkCubicType::kSerpentine:
calc_serp_kcoeffs(t0, s0, t1, s1, skipTerm, &klmCoeffs[0]);

View File

@ -44,11 +44,14 @@ void GrGLSLGeometryProcessor::emitCode(EmitArgs& args) {
vBuilder->codeAppendf("sk_Position = float4(%s", gpArgs.fPositionVar.c_str());
switch (gpArgs.fPositionVar.getType()) {
case kFloat_GrSLType:
vBuilder->codeAppend(", 0"); // fallthru.
vBuilder->codeAppend(", 0");
[[fallthrough]];
case kFloat2_GrSLType:
vBuilder->codeAppend(", 0"); // fallthru.
vBuilder->codeAppend(", 0");
[[fallthrough]];
case kFloat3_GrSLType:
vBuilder->codeAppend(", 1"); // fallthru.
vBuilder->codeAppend(", 1");
[[fallthrough]];
case kFloat4_GrSLType:
vBuilder->codeAppend(");");
break;
@ -171,6 +174,7 @@ void GrGLSLGeometryProcessor::emitTransformCode(GrGLSLVertexBuilder* vb,
}
vb->codeAppend(";\n");
vb->codeAppend("}\n");
break;
}
default:
break;

View File

@ -213,6 +213,7 @@ static void update_degenerate_test(DegenerateTestData* data, const SkPoint& pt)
if (SkScalarAbs(data->fLineNormal.dot(pt) + data->fLineC) > kClose) {
data->fStage = DegenerateTestData::kNonDegenerate;
}
break;
case DegenerateTestData::kNonDegenerate:
break;
default:

View File

@ -583,7 +583,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
switch (path.getFillType()) {
case SkPathFillType::kInverseEvenOdd:
reverse = true;
// fallthrough
[[fallthrough]];
case SkPathFillType::kEvenOdd:
passes[0] = &gEOStencilPass;
if (stencilOnly) {
@ -602,7 +602,7 @@ bool GrDefaultPathRenderer::internalDrawPath(GrRenderTargetContext* renderTarget
case SkPathFillType::kInverseWinding:
reverse = true;
// fallthrough
[[fallthrough]];
case SkPathFillType::kWinding:
passes[0] = &gWindStencilPass;
passCount = 2;

View File

@ -191,8 +191,8 @@ namespace SK_OPTS_NS {
// Handle last 0-3 bytes.
uint32_t k = 0;
switch (bytes & 3) {
case 3: k ^= data[2] << 16;
case 2: k ^= data[1] << 8;
case 3: k ^= data[2] << 16; [[fallthrough]];
case 2: k ^= data[1] << 8; [[fallthrough]];
case 1: k ^= data[0] << 0;
k *= 0xcc9e2d51;
k = (k << 15) | (k >> 17);

View File

@ -625,13 +625,13 @@ namespace SK_OPTS_NS {
F _04, _15, _26, _37;
_04 = _15 = _26 = _37 = 0;
switch (tail) {
case 0: _37 = _mm256_insertf128_ps(_37, _mm_loadu_ps(ptr+28), 1);
case 7: _26 = _mm256_insertf128_ps(_26, _mm_loadu_ps(ptr+24), 1);
case 6: _15 = _mm256_insertf128_ps(_15, _mm_loadu_ps(ptr+20), 1);
case 5: _04 = _mm256_insertf128_ps(_04, _mm_loadu_ps(ptr+16), 1);
case 4: _37 = _mm256_insertf128_ps(_37, _mm_loadu_ps(ptr+12), 0);
case 3: _26 = _mm256_insertf128_ps(_26, _mm_loadu_ps(ptr+ 8), 0);
case 2: _15 = _mm256_insertf128_ps(_15, _mm_loadu_ps(ptr+ 4), 0);
case 0: _37 = _mm256_insertf128_ps(_37, _mm_loadu_ps(ptr+28), 1); [[fallthrough]];
case 7: _26 = _mm256_insertf128_ps(_26, _mm_loadu_ps(ptr+24), 1); [[fallthrough]];
case 6: _15 = _mm256_insertf128_ps(_15, _mm_loadu_ps(ptr+20), 1); [[fallthrough]];
case 5: _04 = _mm256_insertf128_ps(_04, _mm_loadu_ps(ptr+16), 1); [[fallthrough]];
case 4: _37 = _mm256_insertf128_ps(_37, _mm_loadu_ps(ptr+12), 0); [[fallthrough]];
case 3: _26 = _mm256_insertf128_ps(_26, _mm_loadu_ps(ptr+ 8), 0); [[fallthrough]];
case 2: _15 = _mm256_insertf128_ps(_15, _mm_loadu_ps(ptr+ 4), 0); [[fallthrough]];
case 1: _04 = _mm256_insertf128_ps(_04, _mm_loadu_ps(ptr+ 0), 0);
}
@ -1148,11 +1148,11 @@ SI V load(const T* src, size_t tail) {
if (__builtin_expect(tail, 0)) {
V v{}; // Any inactive lanes are zeroed.
switch (tail) {
case 7: v[6] = src[6];
case 6: v[5] = src[5];
case 5: v[4] = src[4];
case 7: v[6] = src[6]; [[fallthrough]];
case 6: v[5] = src[5]; [[fallthrough]];
case 5: v[4] = src[4]; [[fallthrough]];
case 4: memcpy(&v, src, 4*sizeof(T)); break;
case 3: v[2] = src[2];
case 3: v[2] = src[2]; [[fallthrough]];
case 2: memcpy(&v, src, 2*sizeof(T)); break;
case 1: memcpy(&v, src, 1*sizeof(T)); break;
}
@ -1168,11 +1168,11 @@ SI void store(T* dst, V v, size_t tail) {
__builtin_assume(tail < N);
if (__builtin_expect(tail, 0)) {
switch (tail) {
case 7: dst[6] = v[6];
case 6: dst[5] = v[5];
case 5: dst[4] = v[4];
case 7: dst[6] = v[6]; [[fallthrough]];
case 6: dst[5] = v[5]; [[fallthrough]];
case 5: dst[4] = v[4]; [[fallthrough]];
case 4: memcpy(dst, &v, 4*sizeof(T)); break;
case 3: dst[2] = v[2];
case 3: dst[2] = v[2]; [[fallthrough]];
case 2: memcpy(dst, &v, 2*sizeof(T)); break;
case 1: memcpy(dst, &v, 1*sizeof(T)); break;
}
@ -3403,20 +3403,20 @@ SI V load(const T* ptr, size_t tail) {
switch (tail & (N-1)) {
case 0: memcpy(&v, ptr, sizeof(v)); break;
#if defined(JUMPER_IS_HSW) || defined(JUMPER_IS_SKX)
case 15: v[14] = ptr[14];
case 14: v[13] = ptr[13];
case 13: v[12] = ptr[12];
case 15: v[14] = ptr[14]; [[fallthrough]];
case 14: v[13] = ptr[13]; [[fallthrough]];
case 13: v[12] = ptr[12]; [[fallthrough]];
case 12: memcpy(&v, ptr, 12*sizeof(T)); break;
case 11: v[10] = ptr[10];
case 10: v[ 9] = ptr[ 9];
case 9: v[ 8] = ptr[ 8];
case 11: v[10] = ptr[10]; [[fallthrough]];
case 10: v[ 9] = ptr[ 9]; [[fallthrough]];
case 9: v[ 8] = ptr[ 8]; [[fallthrough]];
case 8: memcpy(&v, ptr, 8*sizeof(T)); break;
#endif
case 7: v[ 6] = ptr[ 6];
case 6: v[ 5] = ptr[ 5];
case 5: v[ 4] = ptr[ 4];
case 7: v[ 6] = ptr[ 6]; [[fallthrough]];
case 6: v[ 5] = ptr[ 5]; [[fallthrough]];
case 5: v[ 4] = ptr[ 4]; [[fallthrough]];
case 4: memcpy(&v, ptr, 4*sizeof(T)); break;
case 3: v[ 2] = ptr[ 2];
case 3: v[ 2] = ptr[ 2]; [[fallthrough]];
case 2: memcpy(&v, ptr, 2*sizeof(T)); break;
case 1: v[ 0] = ptr[ 0];
}
@ -3427,20 +3427,20 @@ SI void store(T* ptr, size_t tail, V v) {
switch (tail & (N-1)) {
case 0: memcpy(ptr, &v, sizeof(v)); break;
#if defined(JUMPER_IS_HSW) || defined(JUMPER_IS_SKX)
case 15: ptr[14] = v[14];
case 14: ptr[13] = v[13];
case 13: ptr[12] = v[12];
case 15: ptr[14] = v[14]; [[fallthrough]];
case 14: ptr[13] = v[13]; [[fallthrough]];
case 13: ptr[12] = v[12]; [[fallthrough]];
case 12: memcpy(ptr, &v, 12*sizeof(T)); break;
case 11: ptr[10] = v[10];
case 10: ptr[ 9] = v[ 9];
case 9: ptr[ 8] = v[ 8];
case 11: ptr[10] = v[10]; [[fallthrough]];
case 10: ptr[ 9] = v[ 9]; [[fallthrough]];
case 9: ptr[ 8] = v[ 8]; [[fallthrough]];
case 8: memcpy(ptr, &v, 8*sizeof(T)); break;
#endif
case 7: ptr[ 6] = v[ 6];
case 6: ptr[ 5] = v[ 5];
case 5: ptr[ 4] = v[ 4];
case 7: ptr[ 6] = v[ 6]; [[fallthrough]];
case 6: ptr[ 5] = v[ 5]; [[fallthrough]];
case 5: ptr[ 4] = v[ 4]; [[fallthrough]];
case 4: memcpy(ptr, &v, 4*sizeof(T)); break;
case 3: ptr[ 2] = v[ 2];
case 3: ptr[ 2] = v[ 2]; [[fallthrough]];
case 2: memcpy(ptr, &v, 2*sizeof(T)); break;
case 1: ptr[ 0] = v[ 0];
}
@ -3513,12 +3513,12 @@ SI void load_8888_(const uint32_t* ptr, size_t tail, U16* r, U16* g, U16* b, U16
uint8x8x4_t rgba;
switch (tail & (N-1)) {
case 0: rgba = vld4_u8 ((const uint8_t*)(ptr+0) ); break;
case 7: rgba = vld4_lane_u8((const uint8_t*)(ptr+6), rgba, 6);
case 6: rgba = vld4_lane_u8((const uint8_t*)(ptr+5), rgba, 5);
case 5: rgba = vld4_lane_u8((const uint8_t*)(ptr+4), rgba, 4);
case 4: rgba = vld4_lane_u8((const uint8_t*)(ptr+3), rgba, 3);
case 3: rgba = vld4_lane_u8((const uint8_t*)(ptr+2), rgba, 2);
case 2: rgba = vld4_lane_u8((const uint8_t*)(ptr+1), rgba, 1);
case 7: rgba = vld4_lane_u8((const uint8_t*)(ptr+6), rgba, 6); [[fallthrough]];
case 6: rgba = vld4_lane_u8((const uint8_t*)(ptr+5), rgba, 5); [[fallthrough]];
case 5: rgba = vld4_lane_u8((const uint8_t*)(ptr+4), rgba, 4); [[fallthrough]];
case 4: rgba = vld4_lane_u8((const uint8_t*)(ptr+3), rgba, 3); [[fallthrough]];
case 3: rgba = vld4_lane_u8((const uint8_t*)(ptr+2), rgba, 2); [[fallthrough]];
case 2: rgba = vld4_lane_u8((const uint8_t*)(ptr+1), rgba, 1); [[fallthrough]];
case 1: rgba = vld4_lane_u8((const uint8_t*)(ptr+0), rgba, 0);
}
*r = cast<U16>(rgba.val[0]);
@ -3539,12 +3539,12 @@ SI void store_8888_(uint32_t* ptr, size_t tail, U16 r, U16 g, U16 b, U16 a) {
}};
switch (tail & (N-1)) {
case 0: vst4_u8 ((uint8_t*)(ptr+0), rgba ); break;
case 7: vst4_lane_u8((uint8_t*)(ptr+6), rgba, 6);
case 6: vst4_lane_u8((uint8_t*)(ptr+5), rgba, 5);
case 5: vst4_lane_u8((uint8_t*)(ptr+4), rgba, 4);
case 4: vst4_lane_u8((uint8_t*)(ptr+3), rgba, 3);
case 3: vst4_lane_u8((uint8_t*)(ptr+2), rgba, 2);
case 2: vst4_lane_u8((uint8_t*)(ptr+1), rgba, 1);
case 7: vst4_lane_u8((uint8_t*)(ptr+6), rgba, 6); [[fallthrough]];
case 6: vst4_lane_u8((uint8_t*)(ptr+5), rgba, 5); [[fallthrough]];
case 5: vst4_lane_u8((uint8_t*)(ptr+4), rgba, 4); [[fallthrough]];
case 4: vst4_lane_u8((uint8_t*)(ptr+3), rgba, 3); [[fallthrough]];
case 3: vst4_lane_u8((uint8_t*)(ptr+2), rgba, 2); [[fallthrough]];
case 2: vst4_lane_u8((uint8_t*)(ptr+1), rgba, 1); [[fallthrough]];
case 1: vst4_lane_u8((uint8_t*)(ptr+0), rgba, 0);
}
#else
@ -3669,12 +3669,12 @@ SI void load_88_(const uint16_t* ptr, size_t tail, U16* r, U16* g) {
uint8x8x2_t rg;
switch (tail & (N-1)) {
case 0: rg = vld2_u8 ((const uint8_t*)(ptr+0) ); break;
case 7: rg = vld2_lane_u8((const uint8_t*)(ptr+6), rg, 6);
case 6: rg = vld2_lane_u8((const uint8_t*)(ptr+5), rg, 5);
case 5: rg = vld2_lane_u8((const uint8_t*)(ptr+4), rg, 4);
case 4: rg = vld2_lane_u8((const uint8_t*)(ptr+3), rg, 3);
case 3: rg = vld2_lane_u8((const uint8_t*)(ptr+2), rg, 2);
case 2: rg = vld2_lane_u8((const uint8_t*)(ptr+1), rg, 1);
case 7: rg = vld2_lane_u8((const uint8_t*)(ptr+6), rg, 6); [[fallthrough]];
case 6: rg = vld2_lane_u8((const uint8_t*)(ptr+5), rg, 5); [[fallthrough]];
case 5: rg = vld2_lane_u8((const uint8_t*)(ptr+4), rg, 4); [[fallthrough]];
case 4: rg = vld2_lane_u8((const uint8_t*)(ptr+3), rg, 3); [[fallthrough]];
case 3: rg = vld2_lane_u8((const uint8_t*)(ptr+2), rg, 2); [[fallthrough]];
case 2: rg = vld2_lane_u8((const uint8_t*)(ptr+1), rg, 1); [[fallthrough]];
case 1: rg = vld2_lane_u8((const uint8_t*)(ptr+0), rg, 0);
}
*r = cast<U16>(rg.val[0]);
@ -3692,12 +3692,12 @@ SI void store_88_(uint16_t* ptr, size_t tail, U16 r, U16 g) {
}};
switch (tail & (N-1)) {
case 0: vst2_u8 ((uint8_t*)(ptr+0), rg ); break;
case 7: vst2_lane_u8((uint8_t*)(ptr+6), rg, 6);
case 6: vst2_lane_u8((uint8_t*)(ptr+5), rg, 5);
case 5: vst2_lane_u8((uint8_t*)(ptr+4), rg, 4);
case 4: vst2_lane_u8((uint8_t*)(ptr+3), rg, 3);
case 3: vst2_lane_u8((uint8_t*)(ptr+2), rg, 2);
case 2: vst2_lane_u8((uint8_t*)(ptr+1), rg, 1);
case 7: vst2_lane_u8((uint8_t*)(ptr+6), rg, 6); [[fallthrough]];
case 6: vst2_lane_u8((uint8_t*)(ptr+5), rg, 5); [[fallthrough]];
case 5: vst2_lane_u8((uint8_t*)(ptr+4), rg, 4); [[fallthrough]];
case 4: vst2_lane_u8((uint8_t*)(ptr+3), rg, 3); [[fallthrough]];
case 3: vst2_lane_u8((uint8_t*)(ptr+2), rg, 2); [[fallthrough]];
case 2: vst2_lane_u8((uint8_t*)(ptr+1), rg, 1); [[fallthrough]];
case 1: vst2_lane_u8((uint8_t*)(ptr+0), rg, 0);
}
#else

View File

@ -257,7 +257,7 @@ int SkDCubic::ComplexBreak(const SkPoint pointsPtr[4], SkScalar* t) {
return (int) (t[0] > 0 && t[0] < 1);
}
}
// fall through if no t value found
[[fallthrough]]; // fall through if no t value found
case SkCubicType::kSerpentine:
case SkCubicType::kLocalCusp:
case SkCubicType::kCuspAtInfinity: {
@ -313,9 +313,10 @@ int SkDCubic::ComplexBreak(const SkPoint pointsPtr[4], SkScalar* t) {
}
return resultCount;
}
break;
}
default:
;
break;
}
return 0;
}

View File

@ -506,6 +506,7 @@ bool SkOTTableName::Iterator::next(SkOTTableName::Iterator::Record& record) {
record.name.reset();
break; // continue?
}
[[fallthrough]];
case SkOTTableName::Record::PlatformID::Unicode:
case SkOTTableName::Record::PlatformID::ISO:
SkString_from_UTF16BE(nameString, nameLength, record.name);

View File

@ -190,17 +190,17 @@ LinearGradient4fContext::shadePremulSpan(int x, int y, SkPMColor dst[], int coun
const SkLinearGradient& shader = static_cast<const SkLinearGradient&>(fShader);
switch (shader.fTileMode) {
case SkTileMode::kDecal:
SkASSERT(false); // decal only supported via stages
// fall-through
SkASSERT(false); // decal only supported via stages
[[fallthrough]];
case SkTileMode::kClamp:
this->shadeSpanInternal<premul, SkTileMode::kClamp >(x, y, dst, count, bias0, bias1);
break;
break;
case SkTileMode::kRepeat:
this->shadeSpanInternal<premul, SkTileMode::kRepeat>(x, y, dst, count, bias0, bias1);
break;
break;
case SkTileMode::kMirror:
this->shadeSpanInternal<premul, SkTileMode::kMirror>(x, y, dst, count, bias0, bias1);
break;
break;
}
}

View File

@ -299,7 +299,8 @@ bool SkGradientShaderBase::onAppendStages(const SkStageRec& rec) const {
decal_ctx->limit_x = SkBits2Float(SkFloat2Bits(1.0f) + 1);
// reuse mask + limit_x stage, or create a custom decal_1 that just stores the mask
p->append(SkRasterPipeline::decal_x, decal_ctx);
// fall-through to clamp
[[fallthrough]];
case SkTileMode::kClamp:
if (!fOrigPos) {
// We clamp only when the stops are evenly spaced.

View File

@ -273,20 +273,23 @@ static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
}
#define VECTOR_BINARY_OP(base, field, op) \
case ByteCodeInstruction::base ## 4: \
case ByteCodeInstruction::base ## 4: { \
sp[-4] = sp[-4].field op sp[0].field; \
POP(); \
/* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base ## 3: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
sp[count] = sp[count].field op sp[0].field; \
POP(); \
} /* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base ## 2: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
sp[count] = sp[count].field op sp[0].field; \
POP(); \
} /* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
sp[count] = sp[count].field op sp[0].field; \
@ -297,14 +300,15 @@ static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
// A naive implementation of / or % using skvx operations will likely crash with a divide by zero
// in inactive vector lanes, so we need to be sure to avoid masked-off lanes.
#define VECTOR_BINARY_MASKED_OP(base, field, op) \
case ByteCodeInstruction::base ## 4: \
case ByteCodeInstruction::base ## 4: { \
for (int i = 0; i < VecWidth; ++i) { \
if (mask()[i]) { \
sp[-4].field[i] op ## = sp[0].field[i]; \
} \
} \
POP(); \
/* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base ## 3: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
for (int i = 0; i < VecWidth; ++i) { \
@ -313,7 +317,8 @@ static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
} \
} \
POP(); \
} /* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base ## 2: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
for (int i = 0; i < VecWidth; ++i) { \
@ -322,7 +327,8 @@ static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
} \
} \
POP(); \
} /* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
for (int i = 0; i < VecWidth; ++i) { \
@ -347,20 +353,23 @@ static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
}
#define VECTOR_BINARY_FN(base, field, fn) \
case ByteCodeInstruction::base ## 4: \
case ByteCodeInstruction::base ## 4: { \
sp[-4] = fn(sp[-4].field, sp[0].field); \
POP(); \
/* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base ## 3: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
sp[count] = fn(sp[count].field, sp[0].field); \
POP(); \
} /* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base ## 2: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
sp[count] = fn(sp[count].field, sp[0].field); \
POP(); \
} /* fall through */ \
[[fallthrough]]; \
} \
case ByteCodeInstruction::base: { \
int count = (int)inst - (int)(ByteCodeInstruction::base) - 1; \
sp[count] = fn(sp[count].field, sp[0].field); \
@ -368,11 +377,11 @@ static const uint8_t* DisassembleInstruction(const uint8_t* ip) {
continue; \
}
#define VECTOR_UNARY_FN(base, fn, field) \
case ByteCodeInstruction::base ## 4: sp[-3] = fn(sp[-3].field); \
case ByteCodeInstruction::base ## 3: sp[-2] = fn(sp[-2].field); \
case ByteCodeInstruction::base ## 2: sp[-1] = fn(sp[-1].field); \
case ByteCodeInstruction::base: sp[ 0] = fn(sp[ 0].field); \
#define VECTOR_UNARY_FN(base, fn, field) \
case ByteCodeInstruction::base ## 4: sp[-3] = fn(sp[-3].field); [[fallthrough]]; \
case ByteCodeInstruction::base ## 3: sp[-2] = fn(sp[-2].field); [[fallthrough]]; \
case ByteCodeInstruction::base ## 2: sp[-1] = fn(sp[-1].field); [[fallthrough]]; \
case ByteCodeInstruction::base: sp[ 0] = fn(sp[ 0].field); \
continue;
union VValue {
@ -561,9 +570,9 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
sp[-1] = sp[-1].fSigned & sp[0].fSigned;
POP();
continue;
case ByteCodeInstruction::kNotB4: sp[-3] = ~sp[-3].fSigned;
case ByteCodeInstruction::kNotB3: sp[-2] = ~sp[-2].fSigned;
case ByteCodeInstruction::kNotB2: sp[-1] = ~sp[-1].fSigned;
case ByteCodeInstruction::kNotB4: sp[-3] = ~sp[-3].fSigned; [[fallthrough]];
case ByteCodeInstruction::kNotB3: sp[-2] = ~sp[-2].fSigned; [[fallthrough]];
case ByteCodeInstruction::kNotB2: sp[-1] = ~sp[-1].fSigned; [[fallthrough]];
case ByteCodeInstruction::kNotB: sp[ 0] = ~sp[ 0].fSigned;
continue;
case ByteCodeInstruction::kOrB:
@ -628,23 +637,44 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
VECTOR_BINARY_OP(kCompareULTEQ, fUnsigned, <=)
VECTOR_BINARY_OP(kCompareFLTEQ, fFloat, <=)
case ByteCodeInstruction::kConvertFtoI4: sp[-3] = skvx::cast<int>(sp[-3].fFloat);
case ByteCodeInstruction::kConvertFtoI3: sp[-2] = skvx::cast<int>(sp[-2].fFloat);
case ByteCodeInstruction::kConvertFtoI2: sp[-1] = skvx::cast<int>(sp[-1].fFloat);
case ByteCodeInstruction::kConvertFtoI: sp[ 0] = skvx::cast<int>(sp[ 0].fFloat);
continue;
case ByteCodeInstruction::kConvertFtoI4:
sp[-3] = skvx::cast<int>(sp[-3].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kConvertFtoI3:
sp[-2] = skvx::cast<int>(sp[-2].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kConvertFtoI2:
sp[-1] = skvx::cast<int>(sp[-1].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kConvertFtoI:
sp[ 0] = skvx::cast<int>(sp[ 0].fFloat);
continue;
case ByteCodeInstruction::kConvertStoF4: sp[-3] = skvx::cast<float>(sp[-3].fSigned);
case ByteCodeInstruction::kConvertStoF3: sp[-2] = skvx::cast<float>(sp[-2].fSigned);
case ByteCodeInstruction::kConvertStoF2: sp[-1] = skvx::cast<float>(sp[-1].fSigned);
case ByteCodeInstruction::kConvertStoF: sp[ 0] = skvx::cast<float>(sp[ 0].fSigned);
continue;
case ByteCodeInstruction::kConvertStoF4:
sp[-3] = skvx::cast<float>(sp[-3].fSigned);
[[fallthrough]];
case ByteCodeInstruction::kConvertStoF3:
sp[-2] = skvx::cast<float>(sp[-2].fSigned);
[[fallthrough]];
case ByteCodeInstruction::kConvertStoF2:
sp[-1] = skvx::cast<float>(sp[-1].fSigned);
[[fallthrough]];
case ByteCodeInstruction::kConvertStoF:
sp[ 0] = skvx::cast<float>(sp[ 0].fSigned);
continue;
case ByteCodeInstruction::kConvertUtoF4: sp[-3] = skvx::cast<float>(sp[-3].fUnsigned);
case ByteCodeInstruction::kConvertUtoF3: sp[-2] = skvx::cast<float>(sp[-2].fUnsigned);
case ByteCodeInstruction::kConvertUtoF2: sp[-1] = skvx::cast<float>(sp[-1].fUnsigned);
case ByteCodeInstruction::kConvertUtoF: sp[ 0] = skvx::cast<float>(sp[ 0].fUnsigned);
continue;
case ByteCodeInstruction::kConvertUtoF4:
sp[-3] = skvx::cast<float>(sp[-3].fUnsigned);
[[fallthrough]];
case ByteCodeInstruction::kConvertUtoF3:
sp[-2] = skvx::cast<float>(sp[-2].fUnsigned);
[[fallthrough]];
case ByteCodeInstruction::kConvertUtoF2:
sp[-1] = skvx::cast<float>(sp[-1].fUnsigned);
[[fallthrough]];
case ByteCodeInstruction::kConvertUtoF:
sp[ 0] = skvx::cast<float>(sp[ 0].fUnsigned);
continue;
VECTOR_UNARY_FN(kCos, skvx::cos, fFloat)
@ -652,11 +682,18 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
VECTOR_BINARY_MASKED_OP(kDivideU, fUnsigned, /)
VECTOR_MATRIX_BINARY_OP(kDivideF, fFloat, /)
case ByteCodeInstruction::kDup4: PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
case ByteCodeInstruction::kDup3: PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
case ByteCodeInstruction::kDup2: PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
case ByteCodeInstruction::kDup : PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
continue;
case ByteCodeInstruction::kDup4:
PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
[[fallthrough]];
case ByteCodeInstruction::kDup3:
PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
[[fallthrough]];
case ByteCodeInstruction::kDup2:
PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
[[fallthrough]];
case ByteCodeInstruction::kDup :
PUSH(sp[(int)inst - (int)ByteCodeInstruction::kDup]);
continue;
case ByteCodeInstruction::kDupN: {
int count = READ8();
@ -692,29 +729,36 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
continue;
}
case ByteCodeInstruction::kLoad4: sp[4] = stack[*ip + 3];
case ByteCodeInstruction::kLoad3: sp[3] = stack[*ip + 2];
case ByteCodeInstruction::kLoad2: sp[2] = stack[*ip + 1];
case ByteCodeInstruction::kLoad4: sp[4] = stack[*ip + 3]; [[fallthrough]];
case ByteCodeInstruction::kLoad3: sp[3] = stack[*ip + 2]; [[fallthrough]];
case ByteCodeInstruction::kLoad2: sp[2] = stack[*ip + 1]; [[fallthrough]];
case ByteCodeInstruction::kLoad: sp[1] = stack[*ip + 0];
++ip;
sp += (int)ByteCodeInstruction::kLoad - (int)inst + 1;
continue;
case ByteCodeInstruction::kLoadGlobal4: sp[4] = globals[*ip + 3];
case ByteCodeInstruction::kLoadGlobal3: sp[3] = globals[*ip + 2];
case ByteCodeInstruction::kLoadGlobal2: sp[2] = globals[*ip + 1];
case ByteCodeInstruction::kLoadGlobal4: sp[4] = globals[*ip + 3]; [[fallthrough]];
case ByteCodeInstruction::kLoadGlobal3: sp[3] = globals[*ip + 2]; [[fallthrough]];
case ByteCodeInstruction::kLoadGlobal2: sp[2] = globals[*ip + 1]; [[fallthrough]];
case ByteCodeInstruction::kLoadGlobal: sp[1] = globals[*ip + 0];
++ip;
sp += (int)ByteCodeInstruction::kLoadGlobal - (int)inst + 1;
continue;
case ByteCodeInstruction::kLoadUniform4: sp[4].fFloat = uniforms[*ip + 3];
case ByteCodeInstruction::kLoadUniform3: sp[3].fFloat = uniforms[*ip + 2];
case ByteCodeInstruction::kLoadUniform2: sp[2].fFloat = uniforms[*ip + 1];
case ByteCodeInstruction::kLoadUniform: sp[1].fFloat = uniforms[*ip + 0];
++ip;
sp += (int)ByteCodeInstruction::kLoadUniform - (int)inst + 1;
continue;
case ByteCodeInstruction::kLoadUniform4:
sp[4].fFloat = uniforms[*ip + 3];
[[fallthrough]];
case ByteCodeInstruction::kLoadUniform3:
sp[3].fFloat = uniforms[*ip + 2];
[[fallthrough]];
case ByteCodeInstruction::kLoadUniform2:
sp[2].fFloat = uniforms[*ip + 1];
[[fallthrough]];
case ByteCodeInstruction::kLoadUniform:
sp[1].fFloat = uniforms[*ip + 0];
++ip;
sp += (int)ByteCodeInstruction::kLoadUniform - (int)inst + 1;
continue;
case ByteCodeInstruction::kLoadExtended: {
int count = READ8();
@ -860,9 +904,9 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
VECTOR_BINARY_OP(kMultiplyI, fSigned, *)
VECTOR_MATRIX_BINARY_OP(kMultiplyF, fFloat, *)
case ByteCodeInstruction::kNegateF4: sp[-3] = -sp[-3].fFloat;
case ByteCodeInstruction::kNegateF3: sp[-2] = -sp[-2].fFloat;
case ByteCodeInstruction::kNegateF2: sp[-1] = -sp[-1].fFloat;
case ByteCodeInstruction::kNegateF4: sp[-3] = -sp[-3].fFloat; [[fallthrough]];
case ByteCodeInstruction::kNegateF3: sp[-2] = -sp[-2].fFloat; [[fallthrough]];
case ByteCodeInstruction::kNegateF2: sp[-1] = -sp[-1].fFloat; [[fallthrough]];
case ByteCodeInstruction::kNegateF: sp[ 0] = -sp[ 0].fFloat;
continue;
@ -874,15 +918,15 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
continue;
}
case ByteCodeInstruction::kNegateI4: sp[-3] = -sp[-3].fSigned;
case ByteCodeInstruction::kNegateI3: sp[-2] = -sp[-2].fSigned;
case ByteCodeInstruction::kNegateI2: sp[-1] = -sp[-1].fSigned;
case ByteCodeInstruction::kNegateI4: sp[-3] = -sp[-3].fSigned; [[fallthrough]];
case ByteCodeInstruction::kNegateI3: sp[-2] = -sp[-2].fSigned; [[fallthrough]];
case ByteCodeInstruction::kNegateI2: sp[-1] = -sp[-1].fSigned; [[fallthrough]];
case ByteCodeInstruction::kNegateI: sp[ 0] = -sp[ 0].fSigned;
continue;
case ByteCodeInstruction::kPop4: POP();
case ByteCodeInstruction::kPop3: POP();
case ByteCodeInstruction::kPop2: POP();
case ByteCodeInstruction::kPop4: POP(); [[fallthrough]];
case ByteCodeInstruction::kPop3: POP(); [[fallthrough]];
case ByteCodeInstruction::kPop2: POP(); [[fallthrough]];
case ByteCodeInstruction::kPop: POP();
continue;
@ -993,10 +1037,13 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
case ByteCodeInstruction::kStore4:
stack[*ip+3] = skvx::if_then_else(mask(), POP().fFloat, stack[*ip+3].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kStore3:
stack[*ip+2] = skvx::if_then_else(mask(), POP().fFloat, stack[*ip+2].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kStore2:
stack[*ip+1] = skvx::if_then_else(mask(), POP().fFloat, stack[*ip+1].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kStore:
stack[*ip+0] = skvx::if_then_else(mask(), POP().fFloat, stack[*ip+0].fFloat);
++ip;
@ -1004,10 +1051,13 @@ static bool InnerRun(const ByteCode* byteCode, const ByteCodeFunction* f, VValue
case ByteCodeInstruction::kStoreGlobal4:
globals[*ip+3] = skvx::if_then_else(mask(), POP().fFloat, globals[*ip+3].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kStoreGlobal3:
globals[*ip+2] = skvx::if_then_else(mask(), POP().fFloat, globals[*ip+2].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kStoreGlobal2:
globals[*ip+1] = skvx::if_then_else(mask(), POP().fFloat, globals[*ip+1].fFloat);
[[fallthrough]];
case ByteCodeInstruction::kStoreGlobal:
globals[*ip+0] = skvx::if_then_else(mask(), POP().fFloat, globals[*ip+0].fFloat);
++ip;

View File

@ -426,6 +426,7 @@ void Compiler::addDefinitions(const BasicBlock::Node& node,
(std::unique_ptr<Expression>*) &fContext->fDefined_Expression,
definitions);
}
break;
}
default:
break;
@ -1021,8 +1022,8 @@ void Compiler::simplifyExpression(DefinitionMap& definitions,
return;
}
SkASSERT((*iter)->fKind == BasicBlock::Node::kExpression_Kind);
break;
}
break;
}
default:
break;

View File

@ -522,7 +522,7 @@ void GLSLCodeGenerator::writeFunctionCall(const FunctionCall& c) {
this->write("-dFdy");
nameWritten = true;
}
// fallthru
[[fallthrough]];
case FunctionClass::kDFdx:
case FunctionClass::kFwidth:
if (!fFoundDerivatives &&

View File

@ -1429,7 +1429,7 @@ static bool determine_binary_type(const Context& context,
*outResultType = &left;
return right.canCoerceTo(left);
}
// fall through
[[fallthrough]];
case Token::Kind::TK_STAR:
if (is_matrix_multiply(left, right)) {
// determine final component type
@ -1482,7 +1482,7 @@ static bool determine_binary_type(const Context& context,
*outResultType = &left;
return right.canCoerceTo(left);
}
// fall through
[[fallthrough]];
case Token::Kind::TK_PLUS: // fall through
case Token::Kind::TK_MINUS: // fall through
case Token::Kind::TK_SLASH: // fall through
@ -2726,7 +2726,7 @@ std::unique_ptr<Expression> IRGenerator::convertSwizzle(std::unique_ptr<Expressi
swizzleComponents.push_back(1);
break;
}
// fall through
[[fallthrough]];
case 'z':
case 'b':
case 'p':
@ -2735,7 +2735,7 @@ std::unique_ptr<Expression> IRGenerator::convertSwizzle(std::unique_ptr<Expressi
swizzleComponents.push_back(2);
break;
}
// fall through
[[fallthrough]];
case 'w':
case 'a':
case 'q':
@ -2744,7 +2744,7 @@ std::unique_ptr<Expression> IRGenerator::convertSwizzle(std::unique_ptr<Expressi
swizzleComponents.push_back(3);
break;
}
// fall through
[[fallthrough]];
default:
fErrors.error(base->fOffset, String::printf("invalid swizzle component '%c'",
fields[i]));

View File

@ -1069,7 +1069,7 @@ ASTNode::ID Parser::statement() {
if (this->isType(this->text(start))) {
return this->varDeclarations();
}
// fall through
[[fallthrough]];
default:
return this->expressionStatement();
}
@ -1370,7 +1370,8 @@ ASTNode::ID Parser::forStatement() {
getNode(result).addChild(initializer);
break;
}
} // fall through
[[fallthrough]];
}
default:
initializer = this->expressionStatement();
if (!initializer) {
@ -1960,7 +1961,7 @@ ASTNode::ID Parser::postfixExpression() {
if (this->text(t)[0] != '.') {
return result;
}
// fall through
[[fallthrough]];
case Token::Kind::TK_LBRACKET:
case Token::Kind::TK_DOT:
case Token::Kind::TK_LPAREN:
@ -2016,6 +2017,7 @@ ASTNode::ID Parser::suffix(ASTNode::ID base) {
getNode(result).addChild(base);
return result;
}
[[fallthrough]]; // FIXME(ethannicholas)
}
case Token::Kind::TK_FLOAT_LITERAL: {
// Swizzles that start with a constant number, e.g. '.000r', will be tokenized as
@ -2082,6 +2084,7 @@ ASTNode::ID Parser::term() {
if (this->identifier(&text)) {
RETURN_NODE(t.fOffset, ASTNode::Kind::kIdentifier, std::move(text));
}
break;
}
case Token::Kind::TK_INT_LITERAL: {
SKSL_INT i;

View File

@ -253,10 +253,10 @@ void SPIRVCodeGenerator::writeString(const char* string, size_t length, OutputSt
switch (length % 4) {
case 1:
out.write8(0);
// fall through
[[fallthrough]];
case 2:
out.write8(0);
// fall through
[[fallthrough]];
case 3:
out.write8(0);
break;

View File

@ -63,8 +63,8 @@ void RegexParser::sequence() {
this->quantifiedTerm();
for (;;) {
switch (this->peek()) {
case END: // fall through
case '|': // fall through
case END: [[fallthrough]];
case '|': [[fallthrough]];
case ')': return;
default:
this->sequence();

View File

@ -270,7 +270,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrMeshTest, reporter, ctxInfo) {
if (context->priv().caps()->shaderCaps()->vertexIDSupport()) {
break;
}
// Fallthru.
[[fallthrough]];
case 1:
vertexBuffer = helper->fVertBuffer.get();
break;

View File

@ -140,6 +140,7 @@ static void chalkboard_threaded(skiatest::Reporter* reporter, const char* filena
}
break;
}
[[fallthrough]];
default:
testlines = 0;
for (int i = 0; i < bitCount; ++i) {

View File

@ -84,15 +84,24 @@ void test_Ni(skiatest::Reporter* r) {
v.store(vals);
switch (N) {
case 8: REPORTER_ASSERT(r, vals[4] == e && vals[5] == f && vals[6] == g && vals[7] == h);
case 4: REPORTER_ASSERT(r, vals[2] == c && vals[3] == d);
case 2: REPORTER_ASSERT(r, vals[0] == a && vals[1] == b);
case 8:
REPORTER_ASSERT(r, vals[4] == e && vals[5] == f && vals[6] == g && vals[7] == h);
[[fallthrough]];
case 4:
REPORTER_ASSERT(r, vals[2] == c && vals[3] == d);
[[fallthrough]];
case 2:
REPORTER_ASSERT(r, vals[0] == a && vals[1] == b);
}
switch (N) {
case 8: REPORTER_ASSERT(r, v[4] == e && v[5] == f &&
v[6] == g && v[7] == h);
case 4: REPORTER_ASSERT(r, v[2] == c && v[3] == d);
case 2: REPORTER_ASSERT(r, v[0] == a && v[1] == b);
case 8:
REPORTER_ASSERT(r, v[4] == e && v[5] == f && v[6] == g && v[7] == h);
[[fallthrough]];
case 4:
REPORTER_ASSERT(r, v[2] == c && v[3] == d);
[[fallthrough]];
case 2:
REPORTER_ASSERT(r, v[0] == a && v[1] == b);
}
};

View File

@ -143,8 +143,8 @@ static SkPMColor convert_to_PMColor(SkColorType ct, SkAlphaType at, uint32_t col
color = premul(color);
}
switch (ct) {
case kRGBA_8888_SkColorType:
case kRGB_888x_SkColorType: // fallthrough
case kRGBA_8888_SkColorType: // fallthrough
case kRGB_888x_SkColorType:
color = SkSwizzle_RGBA_to_PMColor(color);
break;
case kBGRA_8888_SkColorType:

View File

@ -410,8 +410,10 @@ static void run_gpu_time_benchmark(sk_gpu_test::GpuTimer* gpuTimer, GrContext* c
using QueryStatus = sk_gpu_test::GpuTimer::QueryStatus;
case QueryStatus::kInvalid:
exitf(ExitErr::kUnavailable, "GPU timer failed");
break;
case QueryStatus::kPending:
exitf(ExitErr::kUnavailable, "timer query still not ready after fence sync");
break;
case QueryStatus::kDisjoint:
if (FLAGS_verbosity >= 4) {
fprintf(stderr, "discarding timer query due to disjoint operations.\n");