From 4284613cfe211bfdcf3506f363d382c044ae8b51 Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Fri, 5 Jan 2018 10:11:11 -0500 Subject: Enable conditional-uninitialized flag Bug: skia:7462 Cq-Include-Trybots: skia.primary:Test-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All-SKNX_NO_SIMD Change-Id: I1c0a09984bf28a5c620a89af56040f018bae6310 Reviewed-on: https://skia-review.googlesource.com/90941 Commit-Queue: Kevin Lubick Reviewed-by: Mike Klein --- bench/ShapesBench.cpp | 4 ++-- experimental/svg/model/SkSVGAttributeParser.cpp | 4 ++-- gn/BUILD.gn | 1 - src/core/SkRegion.cpp | 2 +- src/gpu/GrDrawingManager.cpp | 2 +- src/gpu/GrRectanizer_skyline.cpp | 2 +- src/gpu/GrTextureMaker.cpp | 8 ++----- src/gpu/ccpr/GrCCPRCoverageOp.cpp | 4 ++-- src/gpu/ops/GrMSAAPathRenderer.cpp | 2 +- src/gpu/vk/GrVkPipeline.cpp | 2 +- src/opts/SkBlitMask_opts_arm_neon.cpp | 32 +++++++++---------------- src/pathops/SkPathOpsOp.cpp | 2 +- src/ports/SkFontHost_FreeType.cpp | 2 +- src/ports/SkFontHost_win.cpp | 2 +- tests/PathOpsAngleIdeas.cpp | 2 +- tools/bookmaker/includeWriter.cpp | 6 ++--- 16 files changed, 31 insertions(+), 46 deletions(-) diff --git a/bench/ShapesBench.cpp b/bench/ShapesBench.cpp index 83f0e455b1..67048b9e6b 100644 --- a/bench/ShapesBench.cpp +++ b/bench/ShapesBench.cpp @@ -186,13 +186,13 @@ private: break; } } else { - const SkRRect* outer; + const SkRRect* outer = nullptr; switch (shapeType) { case kRect_ShapesType: outer = &fRect; break; case kOval_ShapesType: outer = &fOval; break; case kRRect_ShapesType: outer = &fRRect; break; } - const SkRRect* inner; + const SkRRect* inner = nullptr; switch (innerShapeType) { case kRect_ShapesType: inner = &fInnerRect; break; case kOval_ShapesType: inner = &fInnerOval; break; diff --git a/experimental/svg/model/SkSVGAttributeParser.cpp b/experimental/svg/model/SkSVGAttributeParser.cpp index 40a3f1a4a9..dc328a1cf6 100644 --- a/experimental/svg/model/SkSVGAttributeParser.cpp +++ b/experimental/svg/model/SkSVGAttributeParser.cpp @@ -315,7 +315,7 @@ bool SkSVGAttributeParser::parseMatrixToken(SkMatrix* matrix) { bool SkSVGAttributeParser::parseTranslateToken(SkMatrix* matrix) { return this->parseParenthesized("translate", [this](SkMatrix* m) -> bool { - SkScalar tx, ty; + SkScalar tx = 0.0, ty = 0.0; this->parseWSToken(); if (!this->parseScalarToken(&tx)) { return false; @@ -332,7 +332,7 @@ bool SkSVGAttributeParser::parseTranslateToken(SkMatrix* matrix) { bool SkSVGAttributeParser::parseScaleToken(SkMatrix* matrix) { return this->parseParenthesized("scale", [this](SkMatrix* m) -> bool { - SkScalar sx, sy; + SkScalar sx = 0.0, sy = 0.0; if (!this->parseScalarToken(&sx)) { return false; } diff --git a/gn/BUILD.gn b/gn/BUILD.gn index 3bc4150311..7d2bff14ec 100644 --- a/gn/BUILD.gn +++ b/gn/BUILD.gn @@ -306,7 +306,6 @@ config("warnings") { cflags += [ "-Wno-cast-align", "-Wno-cast-qual", - "-Wno-conditional-uninitialized", "-Wno-conversion", "-Wno-disabled-macro-expansion", "-Wno-documentation", diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp index 30978854c5..ba185ae38c 100644 --- a/src/core/SkRegion.cpp +++ b/src/core/SkRegion.cpp @@ -1200,7 +1200,7 @@ static bool validate_run(const int32_t* runs, return false; // too many intervals } bool firstInterval = true; - int32_t lastRight; // check that x-intervals are distinct and ordered. + int32_t lastRight = 0; // check that x-intervals are distinct and ordered. while (xIntervals-- > 0) { rect.fLeft = *runs++; rect.fRight = *runs++; diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp index b75dd1c3c4..22afd03065 100644 --- a/src/gpu/GrDrawingManager.cpp +++ b/src/gpu/GrDrawingManager.cpp @@ -285,7 +285,7 @@ GrSemaphoresSubmitted GrDrawingManager::prepareSurfaceForExternalIO( } SkASSERT(proxy); - GrSemaphoresSubmitted result; + GrSemaphoresSubmitted result = GrSemaphoresSubmitted::kNo; if (proxy->priv().hasPendingIO() || numSemaphores) { result = this->flush(proxy, numSemaphores, backendSemaphores); } diff --git a/src/gpu/GrRectanizer_skyline.cpp b/src/gpu/GrRectanizer_skyline.cpp index bbb9859d8e..c4d26e026d 100644 --- a/src/gpu/GrRectanizer_skyline.cpp +++ b/src/gpu/GrRectanizer_skyline.cpp @@ -16,7 +16,7 @@ bool GrRectanizerSkyline::addRect(int width, int height, SkIPoint16* loc) { // find position for new rectangle int bestWidth = this->width() + 1; - int bestX; + int bestX = 0; int bestY = this->height() + 1; int bestIndex = -1; for (int i = 0; i < fSkyline.count(); ++i) { diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp index b3a16f5d8c..6cb9832b59 100644 --- a/src/gpu/GrTextureMaker.cpp +++ b/src/gpu/GrTextureMaker.cpp @@ -42,16 +42,12 @@ sk_sp GrTextureMaker::refTextureProxyForParams(const GrSamplerSt } } - GrSurfaceOrigin origOrigin; + GrSurfaceOrigin origOrigin = original ? original->origin() + : kTopLeft_GrSurfaceOrigin; GrUniqueKey copyKey; this->makeCopyKey(copyParams, ©Key, dstColorSpace); sk_sp cachedProxy; if (copyKey.isValid()) { - if (original) { - origOrigin = original->origin(); - } else { - origOrigin = kTopLeft_GrSurfaceOrigin; - } cachedProxy = fContext->resourceProvider()->findOrCreateProxyByUniqueKey(copyKey, origOrigin); if (cachedProxy && (!willBeMipped || GrMipMapped::kYes == cachedProxy->mipMapped())) { diff --git a/src/gpu/ccpr/GrCCPRCoverageOp.cpp b/src/gpu/ccpr/GrCCPRCoverageOp.cpp index 5cd35cd2c6..76e3ddc2b9 100644 --- a/src/gpu/ccpr/GrCCPRCoverageOp.cpp +++ b/src/gpu/ccpr/GrCCPRCoverageOp.cpp @@ -269,11 +269,11 @@ bool GrCCPRCoverageOpsBuilder::finalize(GrOnFlushResourceProvider* onFlushRP, SkASSERT(cubicInstanceData); PathInfo* currPathInfo = fPathsInfo.begin(); - float atlasOffsetX, atlasOffsetY; + float atlasOffsetX = 0.0, atlasOffsetY = 0.0; Sk2f atlasOffset; int ptsIdx = -1; PrimitiveTallies instanceIndices[2] = {baseInstances[0], baseInstances[1]}; - PrimitiveTallies* currIndices; + PrimitiveTallies* currIndices = nullptr; SkSTArray<256, int32_t, true> currFan; #ifdef SK_DEBUG diff --git a/src/gpu/ops/GrMSAAPathRenderer.cpp b/src/gpu/ops/GrMSAAPathRenderer.cpp index cc0e56d0ad..842d710269 100644 --- a/src/gpu/ops/GrMSAAPathRenderer.cpp +++ b/src/gpu/ops/GrMSAAPathRenderer.cpp @@ -368,7 +368,7 @@ private: SkDEBUGCODE(quads.verticesEnd = quads.vertices + fMaxQuadVertices;) const GrBuffer* lineIndexBuffer = nullptr; - int firstLineIndex; + int firstLineIndex = 0; if (fIsIndexed) { lines.indices = target->makeIndexSpace(3 * fMaxLineVertices, &lineIndexBuffer, &firstLineIndex); diff --git a/src/gpu/vk/GrVkPipeline.cpp b/src/gpu/vk/GrVkPipeline.cpp index a247078f72..b1c8dbeeb4 100644 --- a/src/gpu/vk/GrVkPipeline.cpp +++ b/src/gpu/vk/GrVkPipeline.cpp @@ -57,7 +57,7 @@ static void setup_vertex_input_state(const GrPrimitiveProcessor& primProc, VkPipelineVertexInputStateCreateInfo* vertexInputInfo, SkSTArray<2, VkVertexInputBindingDescription, true>* bindingDescs, VkVertexInputAttributeDescription* attributeDesc) { - uint32_t vertexBinding, instanceBinding; + uint32_t vertexBinding = 0, instanceBinding = 0; if (primProc.hasVertexAttribs()) { vertexBinding = bindingDescs->count(); diff --git a/src/opts/SkBlitMask_opts_arm_neon.cpp b/src/opts/SkBlitMask_opts_arm_neon.cpp index ad12369db6..a32392906e 100644 --- a/src/opts/SkBlitMask_opts_arm_neon.cpp +++ b/src/opts/SkBlitMask_opts_arm_neon.cpp @@ -15,18 +15,13 @@ void SkBlitLCD16OpaqueRow_neon(SkPMColor dst[], const uint16_t src[], int colG = SkColorGetG(color); int colB = SkColorGetB(color); - uint8x8_t vcolR, vcolG, vcolB; - uint8x8_t vopqDstA, vopqDstR, vopqDstG, vopqDstB; - - if (width >= 8) { - vcolR = vdup_n_u8(colR); - vcolG = vdup_n_u8(colG); - vcolB = vdup_n_u8(colB); - vopqDstA = vdup_n_u8(SkGetPackedA32(opaqueDst)); - vopqDstR = vdup_n_u8(SkGetPackedR32(opaqueDst)); - vopqDstG = vdup_n_u8(SkGetPackedG32(opaqueDst)); - vopqDstB = vdup_n_u8(SkGetPackedB32(opaqueDst)); - } + uint8x8_t vcolR = vdup_n_u8(colR); + uint8x8_t vcolG = vdup_n_u8(colG); + uint8x8_t vcolB = vdup_n_u8(colB); + uint8x8_t vopqDstA = vdup_n_u8(SkGetPackedA32(opaqueDst)); + uint8x8_t vopqDstR = vdup_n_u8(SkGetPackedR32(opaqueDst)); + uint8x8_t vopqDstG = vdup_n_u8(SkGetPackedG32(opaqueDst)); + uint8x8_t vopqDstB = vdup_n_u8(SkGetPackedB32(opaqueDst)); while (width >= 8) { uint8x8x4_t vdst; @@ -86,15 +81,10 @@ void SkBlitLCD16Row_neon(SkPMColor dst[], const uint16_t src[], colA = SkAlpha255To256(colA); - uint8x8_t vcolR, vcolG, vcolB; - uint16x8_t vcolA; - - if (width >= 8) { - vcolA = vdupq_n_u16(colA); - vcolR = vdup_n_u8(colR); - vcolG = vdup_n_u8(colG); - vcolB = vdup_n_u8(colB); - } + uint16x8_t vcolA = vdupq_n_u16(colA); + uint8x8_t vcolR = vdup_n_u8(colR); + uint8x8_t vcolG = vdup_n_u8(colG); + uint8x8_t vcolB = vdup_n_u8(colB); while (width >= 8) { uint8x8x4_t vdst; diff --git a/src/pathops/SkPathOpsOp.cpp b/src/pathops/SkPathOpsOp.cpp index 54495109f0..dc8808c141 100644 --- a/src/pathops/SkPathOpsOp.cpp +++ b/src/pathops/SkPathOpsOp.cpp @@ -65,7 +65,7 @@ static SkOpSegment* findChaseOp(SkTDArray& chase, SkOpSpanBase** segment = angle->segment(); SkOpSpanBase* start = angle->start(); SkOpSpanBase* end = angle->end(); - int maxWinding, sumWinding, oppMaxWinding, oppSumWinding; + int maxWinding = 0, sumWinding = 0, oppMaxWinding = 0, oppSumWinding = 0; if (sortable) { segment->setUpWindings(start, end, &sumMiWinding, &sumSuWinding, &maxWinding, &sumWinding, &oppMaxWinding, &oppSumWinding); diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index 4f641aef59..6646384139 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -1294,7 +1294,7 @@ void SkScalerContext_FreeType::generateFontMetrics(SkPaint::FontMetrics* metrics SkScalar x_height = 0.0f; SkScalar avgCharWidth = 0.0f; SkScalar cap_height = 0.0f; - SkScalar strikeoutThickness, strikeoutPosition; + SkScalar strikeoutThickness = 0.0f, strikeoutPosition = 0.0f; TT_OS2* os2 = (TT_OS2*) FT_Get_Sfnt_Table(face, ft_sfnt_os2); if (os2) { x_height = SkIntToScalar(os2->sxHeight) / upem * fScale.y(); diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index ef17ca8af5..64fcfa4f6c 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -2050,7 +2050,7 @@ int LogFontTypeface::onCharsToGlyphs(const void* chars, Encoding encoding, WCHAR scratch[scratchCount]; int glyphIndex = 0; const char* currentUtf8 = reinterpret_cast(chars); - SkUnichar currentChar; + SkUnichar currentChar = 0; if (glyphCount) { currentChar = SkUTF8_NextUnichar(¤tUtf8); } diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp index c50260f27c..e6a75cd41d 100644 --- a/tests/PathOpsAngleIdeas.cpp +++ b/tests/PathOpsAngleIdeas.cpp @@ -611,7 +611,7 @@ DEF_TEST(PathOpsAngleBruteT, reporter) { SkRandom ran; double smaller = SK_Scalar1; SkDQuad small[2]; - SkDEBUGCODE(int smallIndex); + SkDEBUGCODE(int smallIndex = 0); for (int index = 0; index < 100000; ++index) { SkDPoint origin = {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}; QuadPts quad1 = {{origin, {ran.nextRangeF(-1000, 1000), ran.nextRangeF(-1000, 1000)}, diff --git a/tools/bookmaker/includeWriter.cpp b/tools/bookmaker/includeWriter.cpp index 463ac92c91..aeb1200a49 100644 --- a/tools/bookmaker/includeWriter.cpp +++ b/tools/bookmaker/includeWriter.cpp @@ -685,7 +685,7 @@ Definition* IncludeWriter::structMemberOut(const Definition* memberStart, const const char* commentStart = nullptr; ptrdiff_t commentLen = 0; string name(child.fContentStart, (int) (child.fContentEnd - child.fContentStart)); - bool isShort; + bool isShort = false; Definition* commentBlock = nullptr; for (auto memberDef : fBmhStructDef->fChildren) { if (memberDef->fName.length() - name.length() == memberDef->fName.find(name)) { @@ -902,7 +902,7 @@ bool IncludeWriter::populate(Definition* def, ParentPair* prevPair, RootDefiniti // skip include comment // if there is a series of same named methods, write one set of comments, then write all methods string methodName; - const Definition* method; + const Definition* method = nullptr; const Definition* clonedMethod = nullptr; const Definition* memberStart = nullptr; const Definition* memberEnd = nullptr; @@ -1721,7 +1721,7 @@ IncludeWriter::Wrote IncludeWriter::rewriteBlock(int size, const char* data, Phr int lastPrintable = 0; int lastSpace = -1; char c = 0; - char last; + char last = 0; bool embeddedIndirection = false; bool embeddedSymbol = false; bool hasLower = false; -- cgit v1.2.3