From a10abe0283787c369cb59426be6b1bf641911cfa Mon Sep 17 00:00:00 2001 From: Engin Manap Date: Fri, 8 Jul 2022 18:11:06 +0200 Subject: [PATCH] Add fallthrough comment to switch case This allows gcc to identify intentional fallthroughs, which are part all -Wall. Specifically -Werror=implicit-fallthrough --- code/AssetLib/3DS/3DSConverter.cpp | 2 +- code/AssetLib/3DS/3DSLoader.cpp | 3 ++- code/AssetLib/ASE/ASELoader.cpp | 1 + code/AssetLib/LWO/LWOLoader.cpp | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/AssetLib/3DS/3DSConverter.cpp b/code/AssetLib/3DS/3DSConverter.cpp index 5a01429e4..2421d5460 100644 --- a/code/AssetLib/3DS/3DSConverter.cpp +++ b/code/AssetLib/3DS/3DSConverter.cpp @@ -262,7 +262,7 @@ void Discreet3DSImporter::ConvertMaterial(D3DS::Material &oldMat, unsigned int iWire = 1; mat.AddProperty((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME); } - +// fallthrough case D3DS::Discreet3DS::Gouraud: eShading = aiShadingMode_Gouraud; break; diff --git a/code/AssetLib/3DS/3DSLoader.cpp b/code/AssetLib/3DS/3DSLoader.cpp index 0ec8b872a..b76640218 100644 --- a/code/AssetLib/3DS/3DSLoader.cpp +++ b/code/AssetLib/3DS/3DSLoader.cpp @@ -1284,7 +1284,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) { switch (chunk.Flag) { case Discreet3DS::CHUNK_LINRGBF: bGamma = true; - + // fallthrough case Discreet3DS::CHUNK_RGBF: if (sizeof(float) * 3 > diff) { *out = clrError; @@ -1297,6 +1297,7 @@ void Discreet3DSImporter::ParseColorChunk(aiColor3D *out, bool acceptPercent) { case Discreet3DS::CHUNK_LINRGBB: bGamma = true; + // fallthrough case Discreet3DS::CHUNK_RGBB: { if (sizeof(char) * 3 > diff) { *out = clrError; diff --git a/code/AssetLib/ASE/ASELoader.cpp b/code/AssetLib/ASE/ASELoader.cpp index caa708961..7caac24ce 100644 --- a/code/AssetLib/ASE/ASELoader.cpp +++ b/code/AssetLib/ASE/ASELoader.cpp @@ -870,6 +870,7 @@ void ASEImporter::ConvertMaterial(ASE::Material &mat) { unsigned int iWire = 1; mat.pcInstance->AddProperty((int *)&iWire, 1, AI_MATKEY_ENABLE_WIREFRAME); } + // fallthrough case D3DS::Discreet3DS::Gouraud: eShading = aiShadingMode_Gouraud; break; diff --git a/code/AssetLib/LWO/LWOLoader.cpp b/code/AssetLib/LWO/LWOLoader.cpp index 44517a1a6..77589d63c 100644 --- a/code/AssetLib/LWO/LWOLoader.cpp +++ b/code/AssetLib/LWO/LWOLoader.cpp @@ -1540,6 +1540,7 @@ void LWOImporter::LoadLWO2File() { break; } // --- intentionally no break here + // fallthrough case AI_LWO_VMAP: { if (skip) break;