Reland "Add format-specifier warnings to SkDebugf."
This is a reland of e58831cd9578805634b986b434a20757277b3a36
Original change's description:
> Add format-specifier warnings to SkDebugf.
>
> This CL fixes up many existing format-specifier violations in Skia.
> Note that GCC has a warning for formatting nothing, so existing calls to
> `SkDebugf("")` have been removed, or replaced with `SkDebugf("%s", "")`.
> These were apparently meant to be used as a place to set a breakpoint.
>
> Some of our clients also use SkDebug with bad format specifiers, so this
> check is currently only enabled when SKIA_IMPLEMENTATION is true.
>
> Change-Id: I8177a1298a624c6936adc24e0d8f481362a356d0
> Bug: skia:12143
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420902
> Auto-Submit: John Stiles <johnstiles@google.com>
> Commit-Queue: Brian Osman <brianosman@google.com>
> Reviewed-by: Brian Osman <brianosman@google.com>
Bug: skia:12143
Change-Id: Id3c0c21436ebd13899908d5ed5d44c42a0e23921
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/421918
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/tests/ClipperTest.cpp b/tests/ClipperTest.cpp
index 53d3ba2..043f634 100644
--- a/tests/ClipperTest.cpp
+++ b/tests/ClipperTest.cpp
@@ -100,7 +100,8 @@
for (i = 0; i < SK_ARRAY_COUNT(gEmpty); i += 2) {
bool valid = SkLineClipper::IntersectLine(&gEmpty[i], gR, dst);
if (valid) {
- SkDebugf("----- [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
+ SkDebugf("----- [%zu] %g %g -> %g %g\n",
+ i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
}
REPORTER_ASSERT(reporter, !valid);
}
@@ -124,7 +125,8 @@
for (i = 0; i < SK_ARRAY_COUNT(gFull); i += 2) {
bool valid = SkLineClipper::IntersectLine(&gFull[i], gR, dst);
if (!valid || 0 != memcmp(&gFull[i], dst, sizeof(dst))) {
- SkDebugf("++++ [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
+ SkDebugf("++++ [%zu] %g %g -> %g %g\n",
+ i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
}
REPORTER_ASSERT(reporter, valid && !memcmp(&gFull[i], dst, sizeof(dst)));
}
@@ -143,7 +145,8 @@
for (i = 0; i < SK_ARRAY_COUNT(gPartial); i += 4) {
bool valid = SkLineClipper::IntersectLine(&gPartial[i], gR, dst);
if (!valid || 0 != memcmp(&gPartial[i+2], dst, sizeof(dst))) {
- SkDebugf("++++ [%d] %g %g -> %g %g\n", i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
+ SkDebugf("++++ [%zu] %g %g -> %g %g\n",
+ i/2, dst[0].fX, dst[0].fY, dst[1].fX, dst[1].fY);
}
REPORTER_ASSERT(reporter, valid &&
!memcmp(&gPartial[i+2], dst, sizeof(dst)));
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index ca65864..aa176ac 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -197,7 +197,7 @@
//TestReadPixels(reporter, context0, surfaceContext.get(), pixels.get(), "EGLImageTest-read");
- SkDebugf("type: %d\n", surfaceContext->asTextureProxy()->textureType());
+ SkDebugf("type: %d\n", (int)surfaceContext->asTextureProxy()->textureType());
// We should not be able to write to an EXTERNAL texture
TestWritePixels(reporter, context0, surfaceContext.get(), false, "EGLImageTest-write");
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp
index a834c9e..0b3623c 100644
--- a/tests/PathOpsAngleIdeas.cpp
+++ b/tests/PathOpsAngleIdeas.cpp
@@ -334,9 +334,6 @@
rStep /= 2;
} while (rStep > FLT_EPSILON);
if (bestCCW < 0) {
- if (bestR >= maxRadius) {
- SkDebugf("");
- }
REPORTER_ASSERT(reporter, bestR < maxRadius);
return false;
}
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
index 6aee50b..80a10f6 100644
--- a/tests/PathOpsAngleTest.cpp
+++ b/tests/PathOpsAngleTest.cpp
@@ -521,6 +521,5 @@
/* int result = */
PathOpsAngleTester::AllOnOneSide(*first->debugLastAngle(), *next->debugLastAngle());
// SkDebugf("i=%d result=%d\n", i , result);
- // SkDebugf("");
}
}
diff --git a/tests/PathOpsConicIntersectionTest.cpp b/tests/PathOpsConicIntersectionTest.cpp
index b9033f9..d8b9895 100644
--- a/tests/PathOpsConicIntersectionTest.cpp
+++ b/tests/PathOpsConicIntersectionTest.cpp
@@ -311,9 +311,6 @@
SkASSERT(ValidConic(c2));
SkIntersections intersections;
intersections.intersect(c1, c2);
- if (coin && intersections.used() != 2) {
- SkDebugf("");
- }
REPORTER_ASSERT(reporter, !coin || intersections.used() == 2);
double tt1, tt2;
SkDPoint xy1, xy2;
diff --git a/tests/PathOpsConicLineIntersectionTest.cpp b/tests/PathOpsConicLineIntersectionTest.cpp
index 40bb5f6..1106213 100644
--- a/tests/PathOpsConicLineIntersectionTest.cpp
+++ b/tests/PathOpsConicLineIntersectionTest.cpp
@@ -88,7 +88,6 @@
SkDPoint lineXY = line.ptAtT(lineT);
if (!conicXY.approximatelyEqual(lineXY)) {
conicXY.approximatelyEqual(lineXY);
- SkDebugf("");
}
REPORTER_ASSERT(reporter, conicXY.approximatelyEqual(lineXY));
}
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 30a0b38..6892a9d 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -411,9 +411,6 @@
SkDebugf("sect%d,\n", index);
}
#endif
- if (coin && intersections.used() < 2) {
- SkDebugf("");
- }
REPORTER_ASSERT(reporter, !coin || intersections.used() >= 2);
double tt1, tt2;
SkDPoint xy1, xy2;
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 2ceb5fa..8fa0bba 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -450,7 +450,7 @@
if (PathOpsDebug::gCheckForDuplicateNames) {
if (gUniqueNames.end() != std::find(gUniqueNames.begin(), gUniqueNames.end(),
std::string(testName))) {
- SkDebugf(""); // convenience for setting breakpoints
+ SkDebugf("%s", ""); // convenience for setting breakpoints
}
gUniqueNames.push_back(std::string(testName));
return true;
diff --git a/tests/PathOpsQuadLineIntersectionTest.cpp b/tests/PathOpsQuadLineIntersectionTest.cpp
index 0bef7d3..d80cc38 100644
--- a/tests/PathOpsQuadLineIntersectionTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionTest.cpp
@@ -98,7 +98,6 @@
SkDPoint lineXY = line.ptAtT(lineT);
if (!quadXY.approximatelyEqual(lineXY)) {
quadXY.approximatelyEqual(lineXY);
- SkDebugf("");
}
REPORTER_ASSERT(reporter, quadXY.approximatelyEqual(lineXY));
}
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index de4a33b..922c7d6 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -777,13 +777,13 @@
"0x%08x, processor: %s", failedPixelCount, kRenderSize * kRenderSize,
fpGenerator.initialSeed(), fp->dumpInfo().c_str());
if (!coverageMessage.isEmpty()) {
- INFOF(reporter, coverageMessage.c_str());
+ INFOF(reporter, "%s", coverageMessage.c_str());
}
if (!constMessage.isEmpty()) {
- INFOF(reporter, constMessage.c_str());
+ INFOF(reporter, "%s", constMessage.c_str());
}
if (!opaqueMessage.isEmpty()) {
- INFOF(reporter, opaqueMessage.c_str());
+ INFOF(reporter, "%s", opaqueMessage.c_str());
}
if (!loggedFirstWarning) {
SkString input;
diff --git a/tests/RRectInPathTest.cpp b/tests/RRectInPathTest.cpp
index a89d884..45aa0a2 100644
--- a/tests/RRectInPathTest.cpp
+++ b/tests/RRectInPathTest.cpp
@@ -63,7 +63,7 @@
SkPathDirection dir, unsigned start) {
SkRRect out = inner_path_contains_rrect(reporter, in, dir, start);
if (in != out) {
- SkDebugf("");
+ SkDebugf("%s", "");
}
REPORTER_ASSERT(reporter, in == out);
}
@@ -72,7 +72,7 @@
SkPathDirection dir, unsigned start) {
SkRRect out = inner_path_contains_rrect(reporter, in, dir, start);
if (in == out) {
- SkDebugf("");
+ SkDebugf("%s", "");
}
}