Enable -Wcovered-switch-default
When building PDFium with Clang, enable -Wcovered-switch-default.
Fix remaining warnings and remove an unnecessary variable initialization
along the way.
Bug: chromium:1393075
Change-Id: Ia7a439f2ca787f9e3dafb8d30fed2a38b7e29719
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/106670
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nigi <nigi@chromium.org>
diff --git a/BUILD.gn b/BUILD.gn
index cb1da47..ca42418 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -288,6 +288,9 @@
"/wd4577",
]
}
+ if (is_clang) {
+ cflags += [ "-Wcovered-switch-default" ]
+ }
}
config("pdfium_strict_config") {
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index ef3218d..9ea0b24 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -331,7 +331,6 @@
case BlendMode::kLuminosity:
return SkBlendMode::kLuminosity;
case BlendMode::kNormal:
- default:
return SkBlendMode::kSrcOver;
}
}
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp
index 867e167..c9127dd 100644
--- a/fxjs/cjs_field.cpp
+++ b/fxjs/cjs_field.cpp
@@ -235,7 +235,7 @@
const ByteString& bsString) {
DCHECK(pFormFillEnv);
- BorderStyle nBorderStyle = BorderStyle::kSolid;
+ BorderStyle nBorderStyle;
if (bsString == "solid")
nBorderStyle = BorderStyle::kSolid;
else if (bsString == "beveled")
@@ -2022,8 +2022,10 @@
return CJS_Result::Success(pRuntime->NewString("text"));
case FormFieldType::kSignature:
return CJS_Result::Success(pRuntime->NewString("signature"));
+#ifdef PDF_ENABLE_XFA
default:
return CJS_Result::Success(pRuntime->NewString("unknown"));
+#endif
}
}