Get rid of a Windows-only -Wno-switch flag
Get rid of this compiler flag and fix all the core/fxge/ warnings.
Bug: pdfium:188
Change-Id: I37b26847b907e0714d9ed63b1f8f7d6c03697b46
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/106170
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/BUILD.gn b/core/fxge/BUILD.gn
index 944ee3c..307b5b1 100644
--- a/core/fxge/BUILD.gn
+++ b/core/fxge/BUILD.gn
@@ -6,16 +6,6 @@
import("../../pdfium.gni")
import("../../testing/test.gni")
-config("fxge_windows_warnings") {
- visibility = [ ":*" ]
- if (is_clang) {
- cflags = [
- # http://code.google.com/p/pdfium/issues/detail?id=188
- "-Wno-switch",
- ]
- }
-}
-
source_set("fxge") {
sources = [
"agg/fx_agg_driver.cpp",
@@ -119,7 +109,6 @@
]
configs += [
- ":fxge_windows_warnings",
"../../:pdfium_strict_config",
"../../:pdfium_noshorten_config",
]
diff --git a/core/fxge/win32/cgdi_plus_ext.cpp b/core/fxge/win32/cgdi_plus_ext.cpp
index b665f56..06571da 100644
--- a/core/fxge/win32/cgdi_plus_ext.cpp
+++ b/core/fxge/win32/cgdi_plus_ext.cpp
@@ -25,6 +25,7 @@
#include "core/fxge/cfx_path.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "core/fxge/win32/cwin32_platform.h"
+#include "third_party/base/notreached.h"
#include "third_party/base/numerics/safe_conversions.h"
#include "third_party/base/span.h"
@@ -257,6 +258,10 @@
&bitmap);
break;
}
+ case FXDIB_Format::kInvalid:
+ case FXDIB_Format::k1bppMask:
+ case FXDIB_Format::k8bppMask:
+ NOTREACHED_NORETURN();
}
if (dest_height < 0) {
dest_height--;
diff --git a/core/fxge/win32/cwin32_platform.cpp b/core/fxge/win32/cwin32_platform.cpp
index 7691c15..5794e2e 100644
--- a/core/fxge/win32/cwin32_platform.cpp
+++ b/core/fxge/win32/cwin32_platform.cpp
@@ -348,7 +348,7 @@
if (charset == FX_Charset::kANSI || charset == FX_Charset::kSymbol)
charset = FX_Charset::kDefault;
- int subst_pitch_family = pitch_family;
+ int subst_pitch_family;
switch (charset) {
case FX_Charset::kShiftJIS:
subst_pitch_family = FF_ROMAN;
@@ -358,6 +358,9 @@
case FX_Charset::kChineseSimplified:
subst_pitch_family = 0;
break;
+ default:
+ subst_pitch_family = pitch_family;
+ break;
}
HFONT hFont = Win32CreateFont(weight, bItalic, charset, subst_pitch_family,
new_face.c_str());
@@ -393,7 +396,7 @@
case FX_Charset::kHangul:
new_face = "Gulim";
break;
- case FX_Charset::kChineseTraditional:
+ case FX_Charset::kChineseTraditional: {
static const char* const kMonospaceFonts[] = {"Microsoft YaHei",
"MingLiU"};
static const char* const kProportionalFonts[] = {"Microsoft JHengHei",
@@ -402,6 +405,9 @@
new_face.Contains("MSung") ? kMonospaceFonts : kProportionalFonts;
return GetFontFromList(weight, bItalic, charset, subst_pitch_family,
candidate_fonts);
+ }
+ default:
+ break;
}
return Win32CreateFont(weight, bItalic, charset, subst_pitch_family,
new_face.c_str());