Add support for MSVC run-time checks (and control flow guard)
This enables four different options in the compiler, described
below. I also added enough masks to satisfy RTCc when running
all GMs in both 8888 and gl configs.
---
/RTCc - Detects when a value is assigned to a smaller data
type and results in data loss. This happens even when casting.
Masking is required to suppress this.
/RTCs - Various stack-related checks, including uninitialized
data (by initializing locals to a non-zero value), array bounds
checking, and stack pointer corruption that can occur with a
calling convention mismatch.
/RTCu - Reports when a variable is used without having been
initialized. Mostly redundant with compile-time checks.
/guard:cf - This is more of a security option, that computes
all possible targets for indirect calls at compile time, and
verifies that those are the only targets reached at compile
time. Also generates similar logic around switch statements
that turn into jump tables.
Bug: skia:
Change-Id: I7b527af8fd67dec0b6556f38bcd0efc3fd505856
Reviewed-on: https://skia-review.googlesource.com/c/188625
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index dde1f11..e854d69 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -237,7 +237,10 @@
// Delta must be less than 0.5 to prevent over/underflow issues with the input color
SkASSERT(delta <= 0.5);
- SkColor color = SkColorSetARGB((uint8_t)i, (uint8_t)j, (uint8_t)(i + j), (uint8_t)(2 * j - i));
+ SkColor color = SkColorSetARGB((uint8_t)(i & 0xFF),
+ (uint8_t)(j & 0xFF),
+ (uint8_t)((i + j) & 0xFF),
+ (uint8_t)((2 * j - i) & 0xFF));
SkColor4f color4f = SkColor4f::FromColor(color);
for (int i = 0; i < 4; i++) {
if (color4f[i] > 0.5) {
@@ -481,6 +484,10 @@
// written.
timesToInvokeFactory *= FPFactory::Count() / 2;
}
+#if defined(__MSVC_RUNTIME_CHECKS)
+ // This test is infuriatingly slow with MSVC runtime checks enabled
+ timesToInvokeFactory = 1;
+#endif
for (int j = 0; j < timesToInvokeFactory; ++j) {
fp = FPFactory::MakeIdx(i, &testData);
if (!fp->instantiate(resourceProvider)) {