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 <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/bench/ShapesBench.cpp b/bench/ShapesBench.cpp
index 83f0e45..67048b9 100644
--- a/bench/ShapesBench.cpp
+++ b/bench/ShapesBench.cpp
@@ -186,13 +186,13 @@
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 40a3f1a..dc328a1 100644
--- a/experimental/svg/model/SkSVGAttributeParser.cpp
+++ b/experimental/svg/model/SkSVGAttributeParser.cpp
@@ -315,7 +315,7 @@
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::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 3bc4150..7d2bff1 100644
--- a/gn/BUILD.gn
+++ b/gn/BUILD.gn
@@ -306,7 +306,6 @@
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 3097885..ba185ae 100644
--- a/src/core/SkRegion.cpp
+++ b/src/core/SkRegion.cpp
@@ -1200,7 +1200,7 @@
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 b75dd1c..22afd03 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -285,7 +285,7 @@
}
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 bbb9859..c4d26e0 100644
--- a/src/gpu/GrRectanizer_skyline.cpp
+++ b/src/gpu/GrRectanizer_skyline.cpp
@@ -16,7 +16,7 @@
// 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 b3a16f5..6cb9832 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -42,16 +42,12 @@
}
}
- GrSurfaceOrigin origOrigin;
+ GrSurfaceOrigin origOrigin = original ? original->origin()
+ : kTopLeft_GrSurfaceOrigin;
GrUniqueKey copyKey;
this->makeCopyKey(copyParams, ©Key, dstColorSpace);
sk_sp<GrTextureProxy> 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 5cd35cd..76e3ddc 100644
--- a/src/gpu/ccpr/GrCCPRCoverageOp.cpp
+++ b/src/gpu/ccpr/GrCCPRCoverageOp.cpp
@@ -269,11 +269,11 @@
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 cc0e56d..842d710 100644
--- a/src/gpu/ops/GrMSAAPathRenderer.cpp
+++ b/src/gpu/ops/GrMSAAPathRenderer.cpp
@@ -368,7 +368,7 @@
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 a247078..b1c8dbe 100644
--- a/src/gpu/vk/GrVkPipeline.cpp
+++ b/src/gpu/vk/GrVkPipeline.cpp
@@ -57,7 +57,7 @@
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 ad12369..a323929 100644
--- a/src/opts/SkBlitMask_opts_arm_neon.cpp
+++ b/src/opts/SkBlitMask_opts_arm_neon.cpp
@@ -15,18 +15,13 @@
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 @@
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 5449510..dc8808c 100644
--- a/src/pathops/SkPathOpsOp.cpp
+++ b/src/pathops/SkPathOpsOp.cpp
@@ -65,7 +65,7 @@
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 4f641ae..6646384 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -1294,7 +1294,7 @@
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 ef17ca8..64fcfa4 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2050,7 +2050,7 @@
WCHAR scratch[scratchCount];
int glyphIndex = 0;
const char* currentUtf8 = reinterpret_cast<const char*>(chars);
- SkUnichar currentChar;
+ SkUnichar currentChar = 0;
if (glyphCount) {
currentChar = SkUTF8_NextUnichar(¤tUtf8);
}
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp
index c50260f..e6a75cd 100644
--- a/tests/PathOpsAngleIdeas.cpp
+++ b/tests/PathOpsAngleIdeas.cpp
@@ -611,7 +611,7 @@
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 463ac92..aeb1200 100644
--- a/tools/bookmaker/includeWriter.cpp
+++ b/tools/bookmaker/includeWriter.cpp
@@ -685,7 +685,7 @@
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 @@
// 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 @@
int lastPrintable = 0;
int lastSpace = -1;
char c = 0;
- char last;
+ char last = 0;
bool embeddedIndirection = false;
bool embeddedSymbol = false;
bool hasLower = false;