Avoid -Wcovered-switch-default errors in various places When all the cases in a switch statement have been covered, there is no need for the default case. Remove them as they are dead code. This covers the majority of the remaining cases and a separate CL will try to enable the new warning. Bug: chromium:1393075 Change-Id: Iafd7633d62c5d405d257ad3582205a9c23b2e7cc Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/106650 Reviewed-by: Nigi <nigi@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/cpdfsdk_appstream.cpp b/fpdfsdk/cpdfsdk_appstream.cpp index 030ea14..f26d730 100644 --- a/fpdfsdk/cpdfsdk_appstream.cpp +++ b/fpdfsdk/cpdfsdk_appstream.cpp
@@ -465,7 +465,6 @@ float div = fHalfWidth * 0.75f; CFX_FloatRect rect_by_75 = rect.GetDeflated(div, div); switch (nStyle) { - default: case BorderStyle::kSolid: case BorderStyle::kUnderline: { sColor = GetStrokeColorAppStream(color); @@ -545,7 +544,6 @@ const CFX_Color& crText) { CFX_FloatRect rcCenter = rcBBox.GetCenterSquare(); switch (nStyle) { - default: case CheckStyle::kCheck: return GetAppStream_Check(rcCenter, crText); case CheckStyle::kCircle: @@ -570,7 +568,6 @@ const CFX_Color& crText) { CFX_FloatRect rcCenter = rcBBox.GetCenterSquare(); switch (nStyle) { - default: case CheckStyle::kCheck: return GetAppStream_Check(rcCenter, crText); case CheckStyle::kCircle: @@ -957,7 +954,6 @@ AutoClosedQCommand q(&sAppStream); switch (nStyle) { - default: case BorderStyle::kSolid: sColor = GetFillColorAppStream(color); if (sColor.GetLength() > 0) {
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index a1751f9..c5d33d6 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -161,8 +161,6 @@ case BorderStyle::kUnderline: name = "U"; break; - default: - return; } pBSDict->SetNewFor<CPDF_Name>("S", name); }
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 4eb8ebe..c62a4ba 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp
@@ -149,9 +149,6 @@ for (size_t i = 0; i < nRects; i++) pArray[i] = array[i].bottom; break; - default: - NOTREACHED_NORETURN(); - return 0.0f; } float fRet = pArray[0];
diff --git a/fxjs/cfx_globaldata.cpp b/fxjs/cfx_globaldata.cpp index 59b43c1..1d25398 100644 --- a/fxjs/cfx_globaldata.cpp +++ b/fxjs/cfx_globaldata.cpp
@@ -75,7 +75,6 @@ } // Arrays don't get persisted per JS spec page 484. case CFX_Value::DataType::kObject: - default: break; } return false; @@ -346,8 +345,7 @@ SetGlobalVariablePersistent(sEntry, true); } break; case CFX_Value::DataType::kObject: - default: - // Arrays aren't allowed in these buffers, nor are unrecoginzed tags. + // Arrays aren't allowed in these buffers, nor are unrecognized tags. return false; } }
diff --git a/fxjs/cjs_field.cpp b/fxjs/cjs_field.cpp index 53b3449..867e167 100644 --- a/fxjs/cjs_field.cpp +++ b/fxjs/cjs_field.cpp
@@ -2633,7 +2633,5 @@ SetFieldValue(pFormFillEnv, pData->sFieldName, pData->nControlIndex, pData->widestringarray); break; - default: - NOTREACHED(); } }
diff --git a/fxjs/cjs_global.cpp b/fxjs/cjs_global.cpp index 101dee2..5582682 100644 --- a/fxjs/cjs_global.cpp +++ b/fxjs/cjs_global.cpp
@@ -201,10 +201,7 @@ v8::Local<v8::Object>::New(pRuntime->GetIsolate(), pData->pData)); case CFX_Value::DataType::kNull: return CJS_Result::Success(pRuntime->NewNull()); - default: - break; } - return CJS_Result::Failure(JSMessage::kObjectTypeError); } CJS_Result CJS_Global::SetProperty(CJS_Runtime* pRuntime, @@ -491,8 +488,6 @@ break; case CFX_Value::DataType::kNull: break; - default: - return CJS_Result::Failure(JSMessage::kObjectTypeError); } return CJS_Result::Success(); } @@ -523,8 +518,6 @@ pNewData->nType = CFX_Value::DataType::kNull; pNewData->bPersistent = bDefaultPersistent; break; - default: - return CJS_Result::Failure(JSMessage::kObjectTypeError); } m_MapGlobal[propname] = std::move(pNewData); return CJS_Result::Success();
diff --git a/fxjs/js_resources.cpp b/fxjs/js_resources.cpp index c133610..5c054fd 100644 --- a/fxjs/js_resources.cpp +++ b/fxjs/js_resources.cpp
@@ -6,8 +6,6 @@ #include "fxjs/js_resources.h" -#include "third_party/base/notreached.h" - WideString JSGetStringFromID(JSMessage msg) { const char* msg_string = ""; switch (msg) { @@ -92,9 +90,6 @@ case JSMessage::kWouldBeCyclic: msg_string = "Operation would create a cycle."; break; - default: - NOTREACHED(); - break; } return WideString::FromASCII(msg_string); }
diff --git a/testing/image_diff/image_diff_png.cpp b/testing/image_diff/image_diff_png.cpp index c2e8b03..694a240 100644 --- a/testing/image_diff/image_diff_png.cpp +++ b/testing/image_diff/image_diff_png.cpp
@@ -609,10 +609,6 @@ output_color_components = 1; png_output_color_type = PNG_COLOR_TYPE_GRAY; break; - - default: - NOTREACHED(); - return output; } // Row stride should be at least as long as the length of the data.