From dc7b1d2c942b44bcdb2fbd12727a495cf8d57d9e Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Wed, 21 Oct 2020 12:48:21 +0200 Subject: [PATCH] Enable implicit fallthrough warning (#43397) * Enable implicit fallthrough warning This change enables warnings for implicit fallthrough in switch cases and fixes all the cases where the warning was reported. It also fixes some places where the fall through was incorrect. Fortunately, these places were not causing functional issues. --- eng/native/configurecompiler.cmake | 5 ++ .../src/ToolBox/superpmi/mcs/verbildump.cpp | 1 + .../src/classlibnative/bcltype/varargsnative.cpp | 3 +- src/coreclr/src/debug/di/rstype.cpp | 4 +- src/coreclr/src/debug/ee/amd64/amd64walker.cpp | 5 +- src/coreclr/src/debug/ee/controller.cpp | 2 +- src/coreclr/src/debug/ee/debugger.cpp | 3 +- src/coreclr/src/gc/unix/gcenv.unix.cpp | 8 +++ src/coreclr/src/ilasm/assem.cpp | 10 ++++ src/coreclr/src/ilasm/assembler.cpp | 1 + src/coreclr/src/ilasm/prebuilt/asmparse.cpp | 1 + src/coreclr/src/ildasm/dasm.cpp | 2 + src/coreclr/src/ildasm/dasm_sz.cpp | 1 + src/coreclr/src/inc/palclr_win.h | 4 ++ src/coreclr/src/jit/assertionprop.cpp | 2 +- src/coreclr/src/jit/codegenarmarch.cpp | 2 +- src/coreclr/src/jit/codegencommon.cpp | 8 +-- src/coreclr/src/jit/codegenlinear.cpp | 3 +- src/coreclr/src/jit/codegenxarch.cpp | 6 +-- src/coreclr/src/jit/compiler.cpp | 4 +- src/coreclr/src/jit/compiler.h | 4 +- src/coreclr/src/jit/compiler.hpp | 2 +- src/coreclr/src/jit/disasm.cpp | 4 +- src/coreclr/src/jit/eeinterface.cpp | 4 +- src/coreclr/src/jit/emitarm.cpp | 38 +++++++------- src/coreclr/src/jit/emitarm64.cpp | 35 ++++++------- src/coreclr/src/jit/emitxarch.cpp | 56 ++++++++++---------- src/coreclr/src/jit/flowgraph.cpp | 59 ++++++++++++---------- src/coreclr/src/jit/gentree.cpp | 39 +++++++------- src/coreclr/src/jit/hwintrinsiccodegenarm64.cpp | 6 +-- src/coreclr/src/jit/hwintrinsicxarch.cpp | 10 ++-- src/coreclr/src/jit/importer.cpp | 15 +++--- src/coreclr/src/jit/inlinepolicy.cpp | 1 + src/coreclr/src/jit/instr.cpp | 7 ++- src/coreclr/src/jit/lclvars.cpp | 14 ++--- src/coreclr/src/jit/lower.cpp | 7 +-- src/coreclr/src/jit/lowerxarch.cpp | 7 +-- src/coreclr/src/jit/lsraarm.cpp | 13 ++--- src/coreclr/src/jit/lsraarm64.cpp | 12 ++--- src/coreclr/src/jit/lsraxarch.cpp | 4 +- src/coreclr/src/jit/morph.cpp | 7 +-- src/coreclr/src/jit/objectalloc.cpp | 4 +- src/coreclr/src/jit/optcse.cpp | 1 + src/coreclr/src/jit/optimizer.cpp | 21 ++++---- src/coreclr/src/jit/simdashwintrinsic.cpp | 1 + src/coreclr/src/jit/simdcodegenxarch.cpp | 2 +- src/coreclr/src/jit/valuenum.cpp | 10 ++-- src/coreclr/src/jit/valuenum.h | 4 +- src/coreclr/src/md/compiler/custattr_emit.cpp | 4 ++ src/coreclr/src/md/enc/stgio.cpp | 3 ++ src/coreclr/src/pal/inc/pal.h | 12 +++++ src/coreclr/src/pal/inc/rt/sal.h | 13 +++-- src/coreclr/src/pal/inc/rt/specstrings_undef.h | 2 - src/coreclr/src/pal/src/include/pal/palinternal.h | 6 +++ src/coreclr/src/pal/src/libunwind/CMakeLists.txt | 1 + src/coreclr/src/pal/src/safecrt/input.inl | 3 ++ src/coreclr/src/pal/src/safecrt/output.inl | 5 +- .../src/pal/src/safecrt/safecrt_output_l.cpp | 6 ++- src/coreclr/src/pal/src/thread/context.cpp | 2 + src/coreclr/src/utilcode/ilformatter.cpp | 8 +-- src/coreclr/src/utilcode/sstring.cpp | 9 ++-- src/coreclr/src/utilcode/util.cpp | 4 ++ src/coreclr/src/vm/amd64/jitinterfaceamd64.cpp | 4 +- src/coreclr/src/vm/callcounting.cpp | 2 +- src/coreclr/src/vm/class.cpp | 1 + src/coreclr/src/vm/compile.cpp | 4 +- src/coreclr/src/vm/customattribute.cpp | 2 + src/coreclr/src/vm/dllimport.cpp | 2 +- src/coreclr/src/vm/eetoprofinterfaceimpl.cpp | 1 + src/coreclr/src/vm/excep.cpp | 8 +-- src/coreclr/src/vm/exceptmacros.h | 2 +- src/coreclr/src/vm/fieldmarshaler.cpp | 1 + src/coreclr/src/vm/genericdict.cpp | 4 +- src/coreclr/src/vm/invokeutil.cpp | 3 +- src/coreclr/src/vm/jitinterface.cpp | 4 +- src/coreclr/src/vm/methodtablebuilder.cpp | 1 + src/coreclr/src/vm/mlinfo.cpp | 2 + src/coreclr/src/vm/multicorejit.cpp | 1 + src/coreclr/src/vm/prestub.cpp | 2 + src/coreclr/src/vm/proftoeeinterfaceimpl.cpp | 1 + src/coreclr/src/vm/readytoruninfo.cpp | 2 + src/coreclr/src/vm/reflectioninvocation.cpp | 2 +- src/coreclr/src/vm/siginfo.cpp | 4 +- src/coreclr/src/vm/stubgen.cpp | 2 +- src/coreclr/src/vm/stubmgr.cpp | 2 +- src/coreclr/src/vm/threads.cpp | 1 + src/coreclr/src/vm/tieredcompilation.cpp | 4 +- src/coreclr/src/vm/typeparse.cpp | 1 + src/coreclr/src/vm/util.cpp | 4 ++ src/coreclr/src/vm/zapsig.cpp | 1 + src/libraries/Native/Unix/CMakeLists.txt | 8 +++ src/libraries/Native/Unix/Common/pal_utilities.h | 6 +++ .../System.IO.Compression.Native/CMakeLists.txt | 3 ++ .../Unix/System.IO.Ports.Native/pal_termios.c | 2 +- 94 files changed, 380 insertions(+), 247 deletions(-) diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 6dba57f..9c58cad 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -324,6 +324,11 @@ if (CLR_CMAKE_HOST_UNIX) add_compile_options(-Wno-unused-function) add_compile_options(-Wno-tautological-compare) + check_cxx_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH) + if (COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH) + add_compile_options(-Wimplicit-fallthrough) + endif() + #These seem to indicate real issues add_compile_options($<$:-Wno-invalid-offsetof>) diff --git a/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp b/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp index 5a41401..0af9a80 100644 --- a/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp +++ b/src/coreclr/src/ToolBox/superpmi/mcs/verbildump.cpp @@ -893,6 +893,7 @@ void DumpILToConsoleBare(unsigned char* ilCode, int len) LogError("unknown ilCode 0xfe%2x at offset %d in MethodGen::PrettyPrint", ilCode[i], i); break; } + break; default: LogError("unknown ilCode 0x%02x at offset %d in MethodGen::PrettyPrint", ilCode[i], i); break; diff --git a/src/coreclr/src/classlibnative/bcltype/varargsnative.cpp b/src/coreclr/src/classlibnative/bcltype/varargsnative.cpp index 3a9ed22..55dd48b 100644 --- a/src/coreclr/src/classlibnative/bcltype/varargsnative.cpp +++ b/src/coreclr/src/classlibnative/bcltype/varargsnative.cpp @@ -575,7 +575,8 @@ TryAgain: } #endif - // fall through + FALLTHROUGH; + case ELEMENT_TYPE_CLASS: { value->type = data->SigPtr.GetTypeHandleThrowing(data->ArgCookie->pModule, &typeContext); diff --git a/src/coreclr/src/debug/di/rstype.cpp b/src/coreclr/src/debug/di/rstype.cpp index a7412de..3fcb5ee 100644 --- a/src/coreclr/src/debug/di/rstype.cpp +++ b/src/coreclr/src/debug/di/rstype.cpp @@ -590,7 +590,7 @@ HRESULT CordbType::MkType(CordbAppDomain * pAppDomain, pClass->SetIsValueClass(true); pClass->SetIsValueClassKnown(true); - // drop through + FALLTHROUGH; case ELEMENT_TYPE_CLASS: { @@ -2009,6 +2009,7 @@ void CordbType::TypeToExpandedTypeData(DebuggerIPCE_ExpandedTypeData *data) } case ELEMENT_TYPE_END: _ASSERTE(!"bad element type!"); + break; default: data->elementType = m_elementType; @@ -2389,6 +2390,7 @@ HRESULT CordbType::GetTypeID(COR_TYPEID *pId) case ELEMENT_TYPE_BYREF: case ELEMENT_TYPE_FNPTR: IfFailThrow(CORDBG_E_UNSUPPORTED); + break; default: _ASSERTE(!"unexpected element type!"); IfFailThrow(CORDBG_E_UNSUPPORTED); diff --git a/src/coreclr/src/debug/ee/amd64/amd64walker.cpp b/src/coreclr/src/debug/ee/amd64/amd64walker.cpp index 5af7ec7..16807ee 100644 --- a/src/coreclr/src/debug/ee/amd64/amd64walker.cpp +++ b/src/coreclr/src/debug/ee/amd64/amd64walker.cpp @@ -580,6 +580,7 @@ static int opSize(Amd64InstrDecode::InstrForm form, int pp, bool W, bool L, bool // P_M6B_or_M4B case Amd64InstrDecode::InstrForm::MOnly_P_M6B_or_M4B: opSize = P ? 6 : 4; + break; // M4B case Amd64InstrDecode::InstrForm::M1st_M4B: case Amd64InstrDecode::InstrForm::M1st_M4B_I1B: @@ -833,7 +834,7 @@ void NativeWalker::DecodeInstructionForPatchSkip(const BYTE *address, Instructio opCodeMap = Primary; break; } - // Fall through + FALLTHROUGH; case 0xc4: // Vex 3-byte opCodeMap = (OpcodeMap)(int(address[0]) << 8 | (address[1] & 0x1f)); // W is the top bit of opcode2. @@ -965,7 +966,7 @@ void NativeWalker::DecodeInstructionForPatchSkip(const BYTE *address, Instructio case 2: case 3: pInstrAttrib->m_fIsCall = true; - // fall through + FALLTHROUGH; case 4: case 5: pInstrAttrib->m_fIsAbsBranch = true; diff --git a/src/coreclr/src/debug/ee/controller.cpp b/src/coreclr/src/debug/ee/controller.cpp index 81d7ad6..01396cc 100644 --- a/src/coreclr/src/debug/ee/controller.cpp +++ b/src/coreclr/src/debug/ee/controller.cpp @@ -5883,7 +5883,7 @@ bool DebuggerStepper::TrapStep(ControllerStackInfo *info, bool in) // the case we want to use... fIsJump = true; - // fall through... + FALLTHROUGH; case WALK_CALL: LOG((LF_CORDB,LL_INFO10000, "DC::TS:Imm:WALK_CALL ip=%p nextip=%p skipip=%p\n", walker.GetIP(), walker.GetNextIP(), walker.GetSkipIP())); diff --git a/src/coreclr/src/debug/ee/debugger.cpp b/src/coreclr/src/debug/ee/debugger.cpp index 1191287..79d8dd0 100644 --- a/src/coreclr/src/debug/ee/debugger.cpp +++ b/src/coreclr/src/debug/ee/debugger.cpp @@ -10722,6 +10722,7 @@ bool Debugger::HandleIPCEvent(DebuggerIPCEvent * pEvent) // // For regular (non-jit) attach, fall through to do an async break. // + FALLTHROUGH; case DB_IPCE_ASYNC_BREAK: { @@ -12138,7 +12139,7 @@ void Debugger::TypeHandleToExpandedTypeInfo(AreValueTypesBoxed boxed, case ELEMENT_TYPE_VALUETYPE: if (boxed == OnlyPrimitivesUnboxed || boxed == AllBoxed) res->elementType = ELEMENT_TYPE_CLASS; - // drop through + FALLTHROUGH; case ELEMENT_TYPE_CLASS: { diff --git a/src/coreclr/src/gc/unix/gcenv.unix.cpp b/src/coreclr/src/gc/unix/gcenv.unix.cpp index f1e4119..e6b4fc7 100644 --- a/src/coreclr/src/gc/unix/gcenv.unix.cpp +++ b/src/coreclr/src/gc/unix/gcenv.unix.cpp @@ -28,6 +28,12 @@ #undef min #undef max +#if __has_cpp_attribute(fallthrough) +#define FALLTHROUGH [[fallthrough]] +#else +#define FALLTHROUGH +#endif + #include #if HAVE_SYS_TIME_H @@ -792,8 +798,10 @@ bool ReadMemoryValueFromFile(const char* filename, uint64_t* val) { case 'g': case 'G': multiplier = 1024; + FALLTHROUGH; case 'm': case 'M': multiplier = multiplier * 1024; + FALLTHROUGH; case 'k': case 'K': multiplier = multiplier * 1024; } diff --git a/src/coreclr/src/ilasm/assem.cpp b/src/coreclr/src/ilasm/assem.cpp index 7ded7ca..bfe765c 100644 --- a/src/coreclr/src/ilasm/assem.cpp +++ b/src/coreclr/src/ilasm/assem.cpp @@ -1611,16 +1611,26 @@ unsigned hash( switch(len) /* all the case statements fall through */ { case 11: c+=((unsigned)k[10] << 24); + FALLTHROUGH; case 10: c+=((unsigned)k[9] << 16); + FALLTHROUGH; case 9 : c+=((unsigned)k[8] << 8); + FALLTHROUGH; /* the first byte of c is reserved for the length */ case 8 : b+=((unsigned)k[7] << 24); + FALLTHROUGH; case 7 : b+=((unsigned)k[6] << 16); + FALLTHROUGH; case 6 : b+=((unsigned)k[5] << 8); + FALLTHROUGH; case 5 : b+=k[4]; + FALLTHROUGH; case 4 : a+=((unsigned)k[3] << 24); + FALLTHROUGH; case 3 : a+=((unsigned)k[2] << 16); + FALLTHROUGH; case 2 : a+=((unsigned)k[1] << 8); + FALLTHROUGH; case 1 : a+=k[0]; /* case 0: nothing left to add */ } diff --git a/src/coreclr/src/ilasm/assembler.cpp b/src/coreclr/src/ilasm/assembler.cpp index 9a418e0..9748bf7 100644 --- a/src/coreclr/src/ilasm/assembler.cpp +++ b/src/coreclr/src/ilasm/assembler.cpp @@ -1578,6 +1578,7 @@ void Assembler::EmitInstrVarByName(Instr* instr, __in __nullterminated char* lab case CEE_STARG: case CEE_STARG_S: nArgVarFlag++; + FALLTHROUGH; case CEE_LDLOCA: case CEE_LDLOCA_S: case CEE_LDLOC: diff --git a/src/coreclr/src/ilasm/prebuilt/asmparse.cpp b/src/coreclr/src/ilasm/prebuilt/asmparse.cpp index bae2b04..4e7131a 100644 --- a/src/coreclr/src/ilasm/prebuilt/asmparse.cpp +++ b/src/coreclr/src/ilasm/prebuilt/asmparse.cpp @@ -2019,6 +2019,7 @@ yynewstate: yyerrlab: ++yynerrs; + FALLTHROUGH; case 1: case 2: /* incompletely recovered error ... try again */ diff --git a/src/coreclr/src/ildasm/dasm.cpp b/src/coreclr/src/ildasm/dasm.cpp index eecd1ed..f147b4c 100644 --- a/src/coreclr/src/ildasm/dasm.cpp +++ b/src/coreclr/src/ildasm/dasm.cpp @@ -2008,6 +2008,7 @@ BYTE* PrettyPrintCABlobValue(PCCOR_SIGNATURE &typePtr, break; case ELEMENT_TYPE_CLASS : typePtr += CorSigUncompressToken(typePtr, &tk); //skip the following token + FALLTHROUGH; case SERIALIZATION_TYPE_TYPE : appendStr(out,KEYWORD("type")); appendStr(out,appendix); @@ -2668,6 +2669,7 @@ void DumpDefaultValue(mdToken tok, __inout __nullterminated char* szString, void break; } //else fall thru to default case, to report the error + FALLTHROUGH; default: szptr+=sprintf_s(szptr,SZSTRING_REMAINING_SIZE(szptr),ERRORMSG(" /* ILLEGAL CONSTANT type:0x%02X, size:%d bytes, blob: "),MDDV.m_bType,MDDV.m_cbSize); diff --git a/src/coreclr/src/ildasm/dasm_sz.cpp b/src/coreclr/src/ildasm/dasm_sz.cpp index 17b5495..ddfb68e 100644 --- a/src/coreclr/src/ildasm/dasm_sz.cpp +++ b/src/coreclr/src/ildasm/dasm_sz.cpp @@ -211,6 +211,7 @@ unsigned SizeOfField(PCCOR_SIGNATURE *ppSig, ULONG cSig, IMDInternalImport* pImp case ELEMENT_TYPE_CMOD_OPT : case ELEMENT_TYPE_CMOD_REQD : *ppSig += CorSigUncompressToken(*ppSig, &tk); + FALLTHROUGH; case ELEMENT_TYPE_PINNED : case ELEMENT_TYPE_SZARRAY : // uElementNumber doesn't change if(*ppSig < pSigEnd) Reiterate = TRUE; diff --git a/src/coreclr/src/inc/palclr_win.h b/src/coreclr/src/inc/palclr_win.h index be0b725..a9ee78e 100644 --- a/src/coreclr/src/inc/palclr_win.h +++ b/src/coreclr/src/inc/palclr_win.h @@ -140,4 +140,8 @@ typedef HMODULE NATIVE_LIBRARY_HANDLE; #endif // HOST_WINDOWS +#ifndef FALLTHROUGH +#define FALLTHROUGH __fallthrough +#endif // FALLTHROUGH + #endif // __PALCLR_WIN_H__ diff --git a/src/coreclr/src/jit/assertionprop.cpp b/src/coreclr/src/jit/assertionprop.cpp index 6f202ea..de6439f 100644 --- a/src/coreclr/src/jit/assertionprop.cpp +++ b/src/coreclr/src/jit/assertionprop.cpp @@ -4546,7 +4546,7 @@ void Compiler::optImpliedByCopyAssertion(AssertionDsc* copyAssertion, AssertionD // This is the ngen case where we have an indirection of an address. noway_assert((impAssertion->op1.kind == O1K_EXACT_TYPE) || (impAssertion->op1.kind == O1K_SUBTYPE)); - __fallthrough; + FALLTHROUGH; case O2K_CONST_INT: usable = op1MatchesCopy && (impAssertion->op2.u1.iconVal == depAssertion->op2.u1.iconVal); diff --git a/src/coreclr/src/jit/codegenarmarch.cpp b/src/coreclr/src/jit/codegenarmarch.cpp index 6b7ca79..6e987ec 100644 --- a/src/coreclr/src/jit/codegenarmarch.cpp +++ b/src/coreclr/src/jit/codegenarmarch.cpp @@ -207,7 +207,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) case GT_AND: assert(varTypeIsIntegralOrI(treeNode)); - __fallthrough; + FALLTHROUGH; #if !defined(TARGET_64BIT) case GT_ADD_LO: diff --git a/src/coreclr/src/jit/codegencommon.cpp b/src/coreclr/src/jit/codegencommon.cpp index 64285f1..ec19e5c 100644 --- a/src/coreclr/src/jit/codegencommon.cpp +++ b/src/coreclr/src/jit/codegencommon.cpp @@ -1421,7 +1421,7 @@ AGAIN: return false; // Need overflow check } - __fallthrough; + FALLTHROUGH; case GT_LSH: @@ -1486,7 +1486,7 @@ AGAIN: break; } - __fallthrough; + FALLTHROUGH; case GT_LSH: @@ -1568,7 +1568,7 @@ AGAIN: break; } - __fallthrough; + FALLTHROUGH; case GT_LSH: @@ -8401,7 +8401,7 @@ void CodeGen::genFnEpilog(BasicBlock* block) // otherwise the target address doesn't fit in an immediate // so we have to burn a register... - __fallthrough; + FALLTHROUGH; case IAT_PVALUE: // Load the address into a register, load indirect and call through a register diff --git a/src/coreclr/src/jit/codegenlinear.cpp b/src/coreclr/src/jit/codegenlinear.cpp index 557e290..f3f52e7 100644 --- a/src/coreclr/src/jit/codegenlinear.cpp +++ b/src/coreclr/src/jit/codegenlinear.cpp @@ -720,7 +720,7 @@ void CodeGen::genCodeForBBlist() case BBJ_EHCATCHRET: genEHCatchRet(block); - __fallthrough; + FALLTHROUGH; case BBJ_EHFINALLYRET: case BBJ_EHFILTERRET: @@ -731,6 +731,7 @@ void CodeGen::genCodeForBBlist() case BBJ_EHCATCHRET: noway_assert(!"Unexpected BBJ_EHCATCHRET"); // not used on x86 + break; case BBJ_EHFINALLYRET: case BBJ_EHFILTERRET: diff --git a/src/coreclr/src/jit/codegenxarch.cpp b/src/coreclr/src/jit/codegenxarch.cpp index 627e1db..e7a72f2 100644 --- a/src/coreclr/src/jit/codegenxarch.cpp +++ b/src/coreclr/src/jit/codegenxarch.cpp @@ -1481,7 +1481,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) #ifdef TARGET_X86 assert(!treeNode->IsIconHandle(GTF_ICON_TLS_HDL)); #endif // TARGET_X86 - __fallthrough; + FALLTHROUGH; case GT_CNS_DBL: genSetRegToConst(targetReg, targetType, treeNode); @@ -1504,7 +1504,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) genCodeForBinary(treeNode->AsOp()); break; } - __fallthrough; + FALLTHROUGH; case GT_MOD: case GT_UMOD: case GT_UDIV: @@ -1516,7 +1516,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode) case GT_AND: assert(varTypeIsIntegralOrI(treeNode)); - __fallthrough; + FALLTHROUGH; #if !defined(TARGET_64BIT) case GT_ADD_LO: diff --git a/src/coreclr/src/jit/compiler.cpp b/src/coreclr/src/jit/compiler.cpp index f14ffb4..a2b8264 100644 --- a/src/coreclr/src/jit/compiler.cpp +++ b/src/coreclr/src/jit/compiler.cpp @@ -8745,7 +8745,7 @@ void cTreeFlags(Compiler* comp, GenTree* tree) { chars += printf("[INX_STRING_LAYOUT]"); } - __fallthrough; + FALLTHROUGH; case GT_INDEX_ADDR: if (tree->gtFlags & GTF_INX_RNGCHK) { @@ -8963,7 +8963,7 @@ void cTreeFlags(Compiler* comp, GenTree* tree) { chars += printf("[BLK_HASGCPTR]"); } - __fallthrough; + FALLTHROUGH; case GT_BLK: case GT_DYN_BLK: diff --git a/src/coreclr/src/jit/compiler.h b/src/coreclr/src/jit/compiler.h index 16b0386..13e6caf 100644 --- a/src/coreclr/src/jit/compiler.h +++ b/src/coreclr/src/jit/compiler.h @@ -10349,7 +10349,7 @@ public: return result; } } - __fallthrough; + FALLTHROUGH; // Leaf nodes case GT_CATCH_ARG: @@ -10394,7 +10394,7 @@ public: return result; } } - __fallthrough; + FALLTHROUGH; // Standard unary operators case GT_NOT: diff --git a/src/coreclr/src/jit/compiler.hpp b/src/coreclr/src/jit/compiler.hpp index 8b80eb0..ebb55a7 100644 --- a/src/coreclr/src/jit/compiler.hpp +++ b/src/coreclr/src/jit/compiler.hpp @@ -4347,7 +4347,7 @@ void GenTree::VisitOperands(TVisitor visitor) { return; } - __fallthrough; + FALLTHROUGH; // Standard unary operators case GT_STORE_LCL_VAR: diff --git a/src/coreclr/src/jit/disasm.cpp b/src/coreclr/src/jit/disasm.cpp index 56c2ed6..3d900a2 100644 --- a/src/coreclr/src/jit/disasm.cpp +++ b/src/coreclr/src/jit/disasm.cpp @@ -964,7 +964,7 @@ size_t DisAssembler::CbDisassemble(DIS* pdis, } } - __fallthrough; + FALLTHROUGH; case DISX86::trmtaJmpShort: case DISX86::trmtaJmpNear: @@ -1022,7 +1022,7 @@ size_t DisAssembler::CbDisassemble(DIS* pdis, } } - __fallthrough; + FALLTHROUGH; case DISARM64::TRMTA::trmtaBra: case DISARM64::TRMTA::trmtaBraCase: diff --git a/src/coreclr/src/jit/eeinterface.cpp b/src/coreclr/src/jit/eeinterface.cpp index ca63935..2ddc625 100644 --- a/src/coreclr/src/jit/eeinterface.cpp +++ b/src/coreclr/src/jit/eeinterface.cpp @@ -142,7 +142,7 @@ const char* Compiler::eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd) } } } - __fallthrough; + FALLTHROUGH; default: pParam->pArgNames[i] = varTypeName(type); break; @@ -177,7 +177,7 @@ const char* Compiler::eeGetMethodFullName(CORINFO_METHOD_HANDLE hnd) } } } - __fallthrough; + FALLTHROUGH; default: pParam->returnType = varTypeName(retType); break; diff --git a/src/coreclr/src/jit/emitarm.cpp b/src/coreclr/src/jit/emitarm.cpp index 2b558a5..c4bad9f 100644 --- a/src/coreclr/src/jit/emitarm.cpp +++ b/src/coreclr/src/jit/emitarm.cpp @@ -1938,7 +1938,7 @@ void emitter::emitIns_R_I( fmt = IF_T2_K3; sf = INS_FLAGS_NOT_SET; } - __fallthrough; + FALLTHROUGH; #endif // FEATURE_PLI_INSTRUCTION case INS_pld: @@ -2029,7 +2029,7 @@ void emitter::emitIns_R_R( sf = INS_FLAGS_NOT_SET; break; } - __fallthrough; + FALLTHROUGH; case INS_sub: assert(reg1 != REG_PC); // VM debugging single stepper doesn't support PC register with this instruction. @@ -2117,7 +2117,7 @@ void emitter::emitIns_R_R( assert(reg1 != REG_PC); // VM debugging single stepper doesn't support PC register with this instruction. assert(reg2 != REG_PC); assert(reg1 != reg2); - __fallthrough; + FALLTHROUGH; case INS_vabs: case INS_vsqrt: @@ -2133,7 +2133,6 @@ void emitter::emitIns_R_R( assert(isFloatReg(reg1)); assert(isFloatReg(reg2)); } - __fallthrough; VCVT_COMMON: fmt = IF_T2_VFP2; @@ -2177,7 +2176,7 @@ void emitter::emitIns_R_R( sf = INS_FLAGS_SET; break; } - __fallthrough; + FALLTHROUGH; case INS_orn: // assert below fired for bug 281892 where the two operands of an OR were @@ -2437,7 +2436,7 @@ void emitter::emitIns_R_R_I(instruction ins, break; } } - __fallthrough; + FALLTHROUGH; case INS_sub: assert(reg1 != REG_PC); // VM debugging single stepper doesn't support PC register with this instruction. @@ -2573,7 +2572,7 @@ void emitter::emitIns_R_R_I(instruction ins, sf = INS_FLAGS_SET; break; } - __fallthrough; + FALLTHROUGH; case INS_adc: case INS_eor: @@ -2844,10 +2843,9 @@ void emitter::emitIns_R_R_I(instruction ins, } } } - // - // If we did not find a thumb-1 encoding above - // - __fallthrough; + // + // If we did not find a thumb-1 encoding above + // COMMON_THUMB2_LDST: assert(fmt == IF_NONE); @@ -2963,7 +2961,7 @@ void emitter::emitIns_R_R_R(instruction ins, reg3 = reg2; reg2 = REG_SP; } - __fallthrough; + FALLTHROUGH; case INS_sub: assert(reg3 != REG_SP); @@ -3013,7 +3011,7 @@ void emitter::emitIns_R_R_R(instruction ins, emitIns_R_R(ins, attr, reg1, reg3, flags); return; } - __fallthrough; + FALLTHROUGH; case INS_orn: assert(reg1 != REG_PC); // VM debugging single stepper doesn't support PC register with this instruction. @@ -3035,7 +3033,7 @@ void emitter::emitIns_R_R_R(instruction ins, emitIns_R_R(ins, attr, reg1, reg3, flags); return; } - __fallthrough; + FALLTHROUGH; case INS_ror: assert(reg1 != REG_PC); // VM debugging single stepper doesn't support PC register with this instruction. @@ -3070,9 +3068,9 @@ void emitter::emitIns_R_R_R(instruction ins, assert(!"Instruction cannot be encoded"); } } - __fallthrough; #if !defined(USE_HELPERS_FOR_INT_DIV) + FALLTHROUGH; case INS_sdiv: case INS_udiv: #endif // !USE_HELPERS_FOR_INT_DIV @@ -3306,7 +3304,7 @@ void emitter::emitIns_R_R_R_I(instruction ins, } } } - __fallthrough; + FALLTHROUGH; case INS_adc: case INS_and: @@ -6189,7 +6187,7 @@ size_t emitter::emitOutputInstr(insGroup* ig, instrDesc* id, BYTE** dp) case INS_vneg: if (id->idOpSize() == EA_8BYTE) szCode |= (1 << 8); - __fallthrough; + FALLTHROUGH; default: srcSize = dstSize = id->idOpSize(); @@ -7472,13 +7470,13 @@ void emitter::emitDispInsHelp( case IF_T1_I: // Special Compare-and-branch emitDispReg(id->idReg1(), attr, true); - __fallthrough; + FALLTHROUGH; case IF_T1_K: // Special Branch, conditional case IF_T1_M: assert(((instrDescJmp*)id)->idjShort); printf("SHORT "); - __fallthrough; + FALLTHROUGH; case IF_T2_N1: if (fmt == IF_T2_N1) @@ -7486,7 +7484,7 @@ void emitter::emitDispInsHelp( emitDispReg(id->idReg1(), attr, true); printf("%s ADDRESS ", (id->idIns() == INS_movw) ? "LOW" : "HIGH"); } - __fallthrough; + FALLTHROUGH; case IF_T2_J1: case IF_T2_J2: diff --git a/src/coreclr/src/jit/emitarm64.cpp b/src/coreclr/src/jit/emitarm64.cpp index b7ca1dc..6a819f8 100644 --- a/src/coreclr/src/jit/emitarm64.cpp +++ b/src/coreclr/src/jit/emitarm64.cpp @@ -4173,7 +4173,7 @@ void emitter::emitIns_R_R( } break; } - __fallthrough; + FALLTHROUGH; case INS_negs: assert(insOptsNone(opt)); @@ -4184,7 +4184,7 @@ void emitter::emitIns_R_R( case INS_sxtw: assert(size == EA_8BYTE); - __fallthrough; + FALLTHROUGH; case INS_sxtb: case INS_sxth: @@ -4236,7 +4236,7 @@ void emitter::emitIns_R_R( break; } - __fallthrough; + FALLTHROUGH; case INS_rev: assert(insOptsNone(opt)); @@ -4291,7 +4291,7 @@ void emitter::emitIns_R_R( fmt = IF_DV_2L; break; } - __fallthrough; + FALLTHROUGH; case INS_xtn: // Vector operation @@ -4321,7 +4321,7 @@ void emitter::emitIns_R_R( case INS_stlr: assert(isValidGeneralDatasize(size)); - __fallthrough; + FALLTHROUGH; case INS_ldarb: case INS_ldaxrb: @@ -4716,7 +4716,7 @@ void emitter::emitIns_R_R( case INS_st3: case INS_st4: assert(opt != INS_OPTS_1D); // .1D format only permitted with LD1 & ST1 - __fallthrough; + FALLTHROUGH; case INS_ld1: case INS_ld1_2regs: @@ -4835,7 +4835,7 @@ void emitter::emitIns_R_I_I( case INS_mov: ins = INS_movz; // INS_mov with LSL is an alias for INS_movz LSL - __fallthrough; + FALLTHROUGH; case INS_movk: case INS_movn: @@ -5086,7 +5086,7 @@ void emitter::emitIns_R_R_I( case INS_sxtl: case INS_uxtl: assert(imm == 0); - __fallthrough; + FALLTHROUGH; case INS_rshrn: case INS_shrn: @@ -5108,7 +5108,7 @@ void emitter::emitIns_R_R_I( case INS_sxtl2: case INS_uxtl2: assert(imm == 0); - __fallthrough; + FALLTHROUGH; case INS_rshrn2: case INS_shrn2: @@ -5265,7 +5265,7 @@ void emitter::emitIns_R_R_I( break; } } - __fallthrough; + FALLTHROUGH; case INS_ins: // (MOV from general) assert(insOptsNone(opt)); @@ -5412,7 +5412,7 @@ void emitter::emitIns_R_R_I( case INS_st3: case INS_st4: assert(opt != INS_OPTS_1D); // .1D format only permitted with LD1 & ST1 - __fallthrough; + FALLTHROUGH; case INS_ld1: case INS_ld1_2regs: @@ -5704,7 +5704,7 @@ void emitter::emitIns_R_R_R( break; } // Base instruction - __fallthrough; + FALLTHROUGH; case INS_lsl: case INS_lsr: @@ -5767,7 +5767,7 @@ void emitter::emitIns_R_R_R( break; } // Base instruction - __fallthrough; + FALLTHROUGH; case INS_adds: case INS_subs: @@ -5945,7 +5945,7 @@ void emitter::emitIns_R_R_R( fmt = IF_DV_3C; break; } - __fallthrough; + FALLTHROUGH; case INS_ands: case INS_bics: @@ -6136,7 +6136,7 @@ void emitter::emitIns_R_R_R( case INS_st3: case INS_st4: assert(opt != INS_OPTS_1D); // .1D format only permitted with LD1 & ST1 - __fallthrough; + FALLTHROUGH; case INS_ld1: case INS_ld1_2regs: @@ -6484,7 +6484,7 @@ void emitter::emitIns_R_R_R_I(instruction ins, case INS_ldnp: case INS_stnp: assert(insOptsNone(opt)); // Can't use Pre/Post index on these two instructions - __fallthrough; + FALLTHROUGH; case INS_ldp: case INS_stp: @@ -13804,7 +13804,7 @@ emitter::insExecutionCharacteristics emitter::getInsExecutionCharacteristics(ins } // otherwise we should have a br_tail instruction assert(ins == INS_br_tail); - __fallthrough; + FALLTHROUGH; case IF_BR_1A: // ret, br result.insThroughput = PERFSCORE_THROUGHPUT_1C; result.insLatency = PERFSCORE_LATENCY_1C; @@ -13920,6 +13920,7 @@ emitter::insExecutionCharacteristics emitter::getInsExecutionCharacteristics(ins perfScoreUnhandledInstruction(id, &result); break; } + break; // ALU, basic immediate case IF_DI_1A: // cmp, cmn diff --git a/src/coreclr/src/jit/emitxarch.cpp b/src/coreclr/src/jit/emitxarch.cpp index 7774b85..78f900c 100644 --- a/src/coreclr/src/jit/emitxarch.cpp +++ b/src/coreclr/src/jit/emitxarch.cpp @@ -288,7 +288,7 @@ bool emitter::AreFlagsSetToZeroCmp(regNumber reg, emitAttr opSize, bool needsOCF { return false; } - __fallthrough; + FALLTHROUGH; // these always set OC to 0 case INS_and: case INS_or: @@ -7117,7 +7117,7 @@ void emitter::emitIns_Call(EmitCallType callType, id->idSetIsCallRegPtr(); - __fallthrough; + FALLTHROUGH; case EC_INDIR_ARD: // the address is an indirection @@ -7352,7 +7352,7 @@ size_t emitter::emitSizeOfInsDsc(instrDesc* id) return sizeof(instrDescCGCA); } - __fallthrough; + FALLTHROUGH; case ID_OP_SCNS: case ID_OP_CNS: @@ -9192,46 +9192,46 @@ static BYTE* emitOutputNOP(BYTE* dst, size_t nBytes) { case 15: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 14: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 13: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 12: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 11: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 10: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 9: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 8: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 7: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 6: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 5: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 4: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 3: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 2: *dst++ = 0x90; - __fallthrough; + FALLTHROUGH; case 1: *dst++ = 0x90; break; @@ -9243,7 +9243,7 @@ static BYTE* emitOutputNOP(BYTE* dst, size_t nBytes) { case 2: *dst++ = 0x66; - __fallthrough; + FALLTHROUGH; case 1: *dst++ = 0x90; break; @@ -9262,7 +9262,7 @@ static BYTE* emitOutputNOP(BYTE* dst, size_t nBytes) break; case 6: *dst++ = 0x66; - __fallthrough; + FALLTHROUGH; case 5: *dst++ = 0x0F; *dst++ = 0x1F; @@ -9297,13 +9297,13 @@ static BYTE* emitOutputNOP(BYTE* dst, size_t nBytes) break; case 11: *dst++ = 0x66; - __fallthrough; + FALLTHROUGH; case 10: *dst++ = 0x66; - __fallthrough; + FALLTHROUGH; case 9: *dst++ = 0x66; - __fallthrough; + FALLTHROUGH; case 8: *dst++ = 0x0F; *dst++ = 0x1F; @@ -9577,7 +9577,7 @@ BYTE* emitter::emitOutputAM(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) dst += emitOutputByte(dst, 0x66); - __fallthrough; + FALLTHROUGH; case EA_4BYTE: #ifdef TARGET_AMD64 @@ -10342,7 +10342,7 @@ BYTE* emitter::emitOutputSV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) case EA_2BYTE: // Output a size prefix for a 16-bit operand dst += emitOutputByte(dst, 0x66); - __fallthrough; + FALLTHROUGH; case EA_4BYTE: #ifdef TARGET_AMD64 @@ -10808,7 +10808,7 @@ BYTE* emitter::emitOutputCV(BYTE* dst, instrDesc* id, code_t code, CnsVal* addc) case EA_2BYTE: // Output a size prefix for a 16-bit operand dst += emitOutputByte(dst, 0x66); - __fallthrough; + FALLTHROUGH; case EA_4BYTE: #ifdef TARGET_AMD64 @@ -11228,7 +11228,7 @@ BYTE* emitter::emitOutputR(BYTE* dst, instrDesc* id) emitGCregDeadUpd(REG_EAX, dst); emitGCregDeadUpd(REG_EDX, dst); - __fallthrough; + FALLTHROUGH; default: @@ -11394,7 +11394,7 @@ BYTE* emitter::emitOutputRR(BYTE* dst, instrDesc* id) case EA_2BYTE: // Output a size prefix for a 16-bit operand dst += emitOutputByte(dst, 0x66); - __fallthrough; + FALLTHROUGH; case EA_4BYTE: // Set the 'w' bit to get the large version @@ -11945,7 +11945,7 @@ BYTE* emitter::emitOutputRI(BYTE* dst, instrDesc* id) case EA_2BYTE: // Output a size prefix for a 16-bit operand dst += emitOutputByte(dst, 0x66); - __fallthrough; + FALLTHROUGH; case EA_4BYTE: // Set the 'w' bit to get the large version diff --git a/src/coreclr/src/jit/flowgraph.cpp b/src/coreclr/src/jit/flowgraph.cpp index cb080b1..41dc7af 100644 --- a/src/coreclr/src/jit/flowgraph.cpp +++ b/src/coreclr/src/jit/flowgraph.cpp @@ -1534,7 +1534,7 @@ void Compiler::fgRemoveBlockAsPred(BasicBlock* block) } } - __fallthrough; + FALLTHROUGH; case BBJ_COND: case BBJ_ALWAYS: @@ -1549,7 +1549,7 @@ void Compiler::fgRemoveBlockAsPred(BasicBlock* block) } /* If BBJ_COND fall through */ - __fallthrough; + FALLTHROUGH; case BBJ_NONE: @@ -3227,7 +3227,7 @@ void Compiler::fgComputePreds() block->bbNext->bbFlags |= (BBF_JMP_TARGET | BBF_HAS_LABEL); } - __fallthrough; + FALLTHROUGH; case BBJ_LEAVE: // Sometimes fgComputePreds is called before all blocks are imported, so BBJ_LEAVE // blocks are still in the BB list. @@ -3250,7 +3250,7 @@ void Compiler::fgComputePreds() noway_assert(block->bbNext); /* Fall through, the next block is also reachable */ - __fallthrough; + FALLTHROUGH; case BBJ_NONE: @@ -4066,7 +4066,7 @@ BasicBlock* Compiler::fgCreateGCPoll(GCPollType pollType, BasicBlock* block) fgReplacePred(bottom->bbNext, top, bottom); // fall through for the jump target - __fallthrough; + FALLTHROUGH; case BBJ_ALWAYS: case BBJ_CALLFINALLY: @@ -4285,7 +4285,7 @@ private: break; case 1: ++depth; - __fallthrough; + FALLTHROUGH; case 2: slot1 = slot0; slot0 = type; @@ -4892,7 +4892,7 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed // If we are inlining, we need to fail for a CEE_JMP opcode, just like // the list of other opcodes (for all platforms). - __fallthrough; + FALLTHROUGH; case CEE_MKREFANY: case CEE_RETHROW: if (makeInlineObservations) @@ -4969,6 +4969,7 @@ void Compiler::fgFindJumpTargets(const BYTE* codeAddr, IL_OFFSET codeSize, Fixed break; case CEE_RET: retBlocks++; + break; default: break; @@ -5300,7 +5301,8 @@ void Compiler::fgLinkBasicBlocks() BADCODE("Fall thru the end of a method"); } - // Fall through, the next block is also reachable + // Fall through, the next block is also reachable + FALLTHROUGH; case BBJ_NONE: curBBdesc->bbNext->bbRefs++; @@ -5572,7 +5574,7 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, F return retBlocks; } - __fallthrough; + FALLTHROUGH; case CEE_READONLY: case CEE_CONSTRAINED: @@ -5651,18 +5653,18 @@ unsigned Compiler::fgMakeBasicBlocks(const BYTE* codeAddr, IL_OFFSET codeSize, F } } - /* For tail call, we just call CORINFO_HELP_TAILCALL, and it jumps to the - target. So we don't need an epilog - just like CORINFO_HELP_THROW. - Make the block BBJ_RETURN, but we will change it to BBJ_THROW - if the tailness of the call is satisfied. - NOTE : The next instruction is guaranteed to be a CEE_RET - and it will create another BasicBlock. But there may be an - jump directly to that CEE_RET. If we want to avoid creating - an unnecessary block, we need to check if the CEE_RETURN is - the target of a jump. - */ + /* For tail call, we just call CORINFO_HELP_TAILCALL, and it jumps to the + target. So we don't need an epilog - just like CORINFO_HELP_THROW. + Make the block BBJ_RETURN, but we will change it to BBJ_THROW + if the tailness of the call is satisfied. + NOTE : The next instruction is guaranteed to be a CEE_RET + and it will create another BasicBlock. But there may be an + jump directly to that CEE_RET. If we want to avoid creating + an unnecessary block, we need to check if the CEE_RETURN is + the target of a jump. + */ - // fall-through + FALLTHROUGH; case CEE_JMP: /* These are equivalent to a return from the current method @@ -7181,11 +7183,11 @@ GenTreeCall* Compiler::fgGetStaticsCCtorHelper(CORINFO_CLASS_HANDLE cls, CorInfo { case CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR: bNeedClassID = false; - __fallthrough; + FALLTHROUGH; case CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR: callFlags |= GTF_CALL_HOISTABLE; - __fallthrough; + FALLTHROUGH; case CORINFO_HELP_GETSHARED_GCSTATIC_BASE: case CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS: @@ -7198,11 +7200,11 @@ GenTreeCall* Compiler::fgGetStaticsCCtorHelper(CORINFO_CLASS_HANDLE cls, CorInfo case CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR: bNeedClassID = false; - __fallthrough; + FALLTHROUGH; case CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR: callFlags |= GTF_CALL_HOISTABLE; - __fallthrough; + FALLTHROUGH; case CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE: case CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE: @@ -10614,7 +10616,7 @@ void Compiler::fgCompactBlocks(BasicBlock* block, BasicBlock* bNext) // Propagate RETLESS property block->bbFlags |= (bNext->bbFlags & BBF_RETLESS_CALL); - __fallthrough; + FALLTHROUGH; case BBJ_COND: case BBJ_ALWAYS: @@ -11374,7 +11376,7 @@ void Compiler::fgRemoveBlock(BasicBlock* block, bool unreachable) } /* Fall through for the jump case */ - __fallthrough; + FALLTHROUGH; case BBJ_CALLFINALLY: case BBJ_ALWAYS: @@ -14056,7 +14058,7 @@ bool Compiler::fgOptimizeEmptyBlock(BasicBlock* block) /* Can fall through since this is similar with removing * a BBJ_NONE block, only the successor is different */ - __fallthrough; + FALLTHROUGH; case BBJ_NONE: @@ -16629,6 +16631,7 @@ void Compiler::fgDetermineFirstColdBlock() { default: noway_assert(!"Unhandled jumpkind in fgDetermineFirstColdBlock()"); + break; case BBJ_CALLFINALLY: // A BBJ_CALLFINALLY that falls through is always followed @@ -21519,6 +21522,7 @@ void Compiler::fgDebugCheckFlags(GenTree* tree) break; case GT_ADDR: assert(!op1->CanCSE()); + break; case GT_IND: // Do we have a constant integer address as op1? @@ -21590,6 +21594,7 @@ void Compiler::fgDebugCheckFlags(GenTree* tree) // +--------------+----------------+ } } + break; default: break; diff --git a/src/coreclr/src/jit/gentree.cpp b/src/coreclr/src/jit/gentree.cpp index 8c9b64d..e25a3e8 100644 --- a/src/coreclr/src/jit/gentree.cpp +++ b/src/coreclr/src/jit/gentree.cpp @@ -1852,7 +1852,7 @@ AGAIN: { return true; } - __fallthrough; + FALLTHROUGH; case GT_DYN_BLK: if (gtHasRef(tree->AsDynBlk()->Addr(), lclNum, defOnly)) { @@ -2258,7 +2258,7 @@ AGAIN: case GT_STORE_DYN_BLK: hash = genTreeHashAdd(hash, gtHashValue(tree->AsDynBlk()->Data())); - __fallthrough; + FALLTHROUGH; case GT_DYN_BLK: hash = genTreeHashAdd(hash, gtHashValue(tree->AsDynBlk()->Addr())); hash = genTreeHashAdd(hash, gtHashValue(tree->AsDynBlk()->gtDynamicSize)); @@ -3974,7 +3974,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) } } - __fallthrough; + FALLTHROUGH; case GT_DIV: case GT_UDIV: @@ -4183,7 +4183,8 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) break; } - // fall through and set GTF_REVERSE_OPS + // fall through and set GTF_REVERSE_OPS + FALLTHROUGH; case GT_LCL_VAR: case GT_LCL_FLD: @@ -4350,7 +4351,7 @@ unsigned Compiler::gtSetEvalOrder(GenTree* tree) tree->SetOper(GenTree::SwapRelop(oper), GenTree::PRESERVE_VN); } - __fallthrough; + FALLTHROUGH; case GT_ADD: case GT_MUL: @@ -5689,9 +5690,9 @@ bool GenTree::OperMayThrow(Compiler* comp) // return true; } + break; } #endif // FEATURE_HW_INTRINSICS - default: break; } @@ -6152,7 +6153,7 @@ GenTree* Compiler::gtNewZeroConNode(var_types type) break; case TYP_BYREF: - __fallthrough; + FALLTHROUGH; case TYP_REF: zero = gtNewIconNode(0); @@ -9549,7 +9550,7 @@ void GenTreeUseEdgeIterator::AdvanceCall() m_edge = &call->gtCallThisArg->NodeRef(); return; } - __fallthrough; + FALLTHROUGH; case CALL_ARGS: if (m_statePtr != nullptr) @@ -9561,7 +9562,7 @@ void GenTreeUseEdgeIterator::AdvanceCall() } m_statePtr = call->gtCallLateArgs; m_advance = &GenTreeUseEdgeIterator::AdvanceCall; - __fallthrough; + FALLTHROUGH; case CALL_LATE_ARGS: if (m_statePtr != nullptr) @@ -9572,7 +9573,7 @@ void GenTreeUseEdgeIterator::AdvanceCall() return; } m_advance = &GenTreeUseEdgeIterator::AdvanceCall; - __fallthrough; + FALLTHROUGH; case CALL_CONTROL_EXPR: if (call->gtControlExpr != nullptr) @@ -9593,7 +9594,7 @@ void GenTreeUseEdgeIterator::AdvanceCall() m_state = -1; return; } - __fallthrough; + FALLTHROUGH; case CALL_COOKIE: assert(call->gtCallType == CT_INDIRECT); @@ -9604,7 +9605,7 @@ void GenTreeUseEdgeIterator::AdvanceCall() m_edge = &call->gtCallCookie; return; } - __fallthrough; + FALLTHROUGH; case CALL_ADDRESS: assert(call->gtCallType == CT_INDIRECT); @@ -10148,7 +10149,7 @@ void Compiler::gtDispNode(GenTree* tree, IndentStack* indentStack, __in __in_z _ break; } } - __fallthrough; + FALLTHROUGH; case GT_INDEX: case GT_INDEX_ADDR: @@ -11140,7 +11141,7 @@ void Compiler::gtDispLeaf(GenTree* tree, IndentStack* indentStack) case GT_LCL_FLD_ADDR: case GT_STORE_LCL_FLD: isLclFld = true; - __fallthrough; + FALLTHROUGH; case GT_PHI_ARG: case GT_LCL_VAR: @@ -11320,6 +11321,7 @@ void Compiler::gtDispLeaf(GenTree* tree, IndentStack* indentStack) case GT_JCMP: printf(" cond=%s%s", (tree->gtFlags & GTF_JCMP_TST) ? "TEST_" : "", (tree->gtFlags & GTF_JCMP_EQ) ? "EQ" : "NE"); + break; default: assert(!"don't know how to display tree leaf node"); @@ -13254,7 +13256,7 @@ GenTree* Compiler::gtFoldExprSpecial(GenTree* tree) // unsigned (0 > x) is always false return NewMorphedIntConNode(0); } - __fallthrough; + FALLTHROUGH; case GT_EQ: case GT_NE: @@ -14534,7 +14536,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree) return tree; } - __fallthrough; + FALLTHROUGH; case TYP_BYREF: @@ -14581,6 +14583,7 @@ GenTree* Compiler::gtFoldExprConst(GenTree* tree) #endif goto DONE; } + break; default: break; @@ -17456,8 +17459,8 @@ GenTree* Compiler::gtGetSIMDZero(var_types simdType, var_types baseType, CORINFO break; case TYP_UINT: assert(simdHandle == m_simdHandleCache->Vector64UIntHandle); - break; #endif // defined(TARGET_ARM64) && defined(FEATURE_HW_INTRINSICS) + break; default: break; } @@ -19242,7 +19245,7 @@ void ReturnTypeDesc::InitializeStructReturnType(Compiler* comp, CORINFO_CLASS_HA { case Compiler::SPK_EnclosingType: m_isEnclosingType = true; - __fallthrough; + FALLTHROUGH; case Compiler::SPK_PrimitiveType: { diff --git a/src/coreclr/src/jit/hwintrinsiccodegenarm64.cpp b/src/coreclr/src/jit/hwintrinsiccodegenarm64.cpp index 162fd45..5b2fd24 100644 --- a/src/coreclr/src/jit/hwintrinsiccodegenarm64.cpp +++ b/src/coreclr/src/jit/hwintrinsiccodegenarm64.cpp @@ -204,17 +204,17 @@ void CodeGen::genHWIntrinsic(GenTreeHWIntrinsic* node) case 4: assert(intrin.op4 != nullptr); op4Reg = intrin.op4->GetRegNum(); - __fallthrough; + FALLTHROUGH; case 3: assert(intrin.op3 != nullptr); op3Reg = intrin.op3->GetRegNum(); - __fallthrough; + FALLTHROUGH; case 2: assert(intrin.op2 != nullptr); op2Reg = intrin.op2->GetRegNum(); - __fallthrough; + FALLTHROUGH; case 1: assert(intrin.op1 != nullptr); diff --git a/src/coreclr/src/jit/hwintrinsicxarch.cpp b/src/coreclr/src/jit/hwintrinsicxarch.cpp index e624f18..7d288e3 100644 --- a/src/coreclr/src/jit/hwintrinsicxarch.cpp +++ b/src/coreclr/src/jit/hwintrinsicxarch.cpp @@ -551,7 +551,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, break; } - __fallthrough; + FALLTHROUGH; } case NI_Vector128_As: @@ -969,7 +969,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, // Using software fallback if JIT/hardware don't support AVX instructions and YMM registers return nullptr; } - __fallthrough; + FALLTHROUGH; } case NI_Vector128_WithElement: @@ -1137,7 +1137,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, valueOp = gtNewSimdHWIntrinsicNode(TYP_SIMD16, valueOp, NI_Vector128_CreateScalarUnsafe, TYP_FLOAT, 16); immNode->AsIntCon()->SetIconValue(imm8 * 16); - __fallthrough; + FALLTHROUGH; } } @@ -1193,7 +1193,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, // Using software fallback if JIT/hardware don't support AVX instructions and YMM registers return nullptr; } - __fallthrough; + FALLTHROUGH; } case NI_Vector128_GetElement: @@ -1331,7 +1331,7 @@ GenTree* Compiler::impBaseIntrinsic(NamedIntrinsic intrinsic, NI_SSE_Shuffle, TYP_FLOAT, 16); return gtNewSimdHWIntrinsicNode(retType, vectorOp, NI_Vector128_ToScalar, TYP_FLOAT, 16); } - __fallthrough; + FALLTHROUGH; } case TYP_UBYTE: diff --git a/src/coreclr/src/jit/importer.cpp b/src/coreclr/src/jit/importer.cpp index 6e77657..248be8c 100644 --- a/src/coreclr/src/jit/importer.cpp +++ b/src/coreclr/src/jit/importer.cpp @@ -1671,7 +1671,7 @@ GenTree* Compiler::impNormStructVal(GenTree* structVal, structLcl = structVal->AsLclVarCommon(); // Wrap it in a GT_OBJ. structVal = gtNewObjNode(structHnd, gtNewOperNode(GT_ADDR, TYP_BYREF, structVal)); - __fallthrough; + FALLTHROUGH; case GT_OBJ: case GT_BLK: @@ -5629,7 +5629,8 @@ void Compiler::verVerifyCall(OPCODE opcode, goto DONE_ARGS; } } - // fall thru to default checks + // fall thru to default checks + FALLTHROUGH; default: VerifyOrReturn(!(mflags & CORINFO_FLG_ABSTRACT), "method abstract"); } @@ -13158,6 +13159,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) case CEE_CONV_OVF_U_UN: case CEE_CONV_U: isNative = true; + break; default: // leave 'isNative' = false; break; @@ -14125,7 +14127,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) } } - // fall through + FALLTHROUGH; case CEE_CALLVIRT: case CEE_CALL: @@ -14551,7 +14553,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) #else fieldInfo.fieldAccessor = CORINFO_FIELD_STATIC_ADDR_HELPER; - __fallthrough; + FALLTHROUGH; #endif case CORINFO_FIELD_STATIC_ADDR_HELPER: @@ -14593,7 +14595,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) } } - __fallthrough; + FALLTHROUGH; case CORINFO_FIELD_STATIC_RVA_ADDRESS: case CORINFO_FIELD_STATIC_SHARED_STATIC_HELPER: @@ -14858,7 +14860,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) #else fieldInfo.fieldAccessor = CORINFO_FIELD_STATIC_ADDR_HELPER; - __fallthrough; + FALLTHROUGH; #endif case CORINFO_FIELD_STATIC_ADDR_HELPER: @@ -16365,6 +16367,7 @@ void Compiler::impImportBlockCode(BasicBlock* block) case 0xCC: OutputDebugStringA("CLR: Invalid x86 breakpoint in IL stream\n"); + FALLTHROUGH; case CEE_ILLEGAL: case CEE_MACRO_END: diff --git a/src/coreclr/src/jit/inlinepolicy.cpp b/src/coreclr/src/jit/inlinepolicy.cpp index 09a029f..cb113e6 100644 --- a/src/coreclr/src/jit/inlinepolicy.cpp +++ b/src/coreclr/src/jit/inlinepolicy.cpp @@ -1536,6 +1536,7 @@ void DiscretionaryPolicy::ComputeOpcodeBin(OPCODE opcode) case CEE_RET: m_ReturnCount++; + break; default: break; diff --git a/src/coreclr/src/jit/instr.cpp b/src/coreclr/src/jit/instr.cpp index 11e3b78..0c6d91f 100644 --- a/src/coreclr/src/jit/instr.cpp +++ b/src/coreclr/src/jit/instr.cpp @@ -774,7 +774,7 @@ AGAIN: { case INS_mov: ins = ins_Load(tree->TypeGet()); - __fallthrough; + FALLTHROUGH; case INS_lea: case INS_ldr: @@ -2231,8 +2231,10 @@ instruction CodeGen::ins_FloatConv(var_types to, var_types from) { case TYP_FLOAT: NYI("long to float"); + break; case TYP_DOUBLE: NYI("long to double"); + break; default: unreached(); } @@ -2246,6 +2248,7 @@ instruction CodeGen::ins_FloatConv(var_types to, var_types from) return INS_vcvt_f2u; case TYP_LONG: NYI("float to long"); + break; case TYP_DOUBLE: return INS_vcvt_f2d; case TYP_FLOAT: @@ -2263,6 +2266,7 @@ instruction CodeGen::ins_FloatConv(var_types to, var_types from) return INS_vcvt_d2u; case TYP_LONG: NYI("double to long"); + break; case TYP_FLOAT: return INS_vcvt_d2f; case TYP_DOUBLE: @@ -2274,6 +2278,7 @@ instruction CodeGen::ins_FloatConv(var_types to, var_types from) default: unreached(); } + unreached(); } #elif defined(TARGET_ARM64) diff --git a/src/coreclr/src/jit/lclvars.cpp b/src/coreclr/src/jit/lclvars.cpp index a45ffcb..d0c6547 100644 --- a/src/coreclr/src/jit/lclvars.cpp +++ b/src/coreclr/src/jit/lclvars.cpp @@ -3054,9 +3054,6 @@ unsigned Compiler::lvaLclSize(unsigned varNum) assert(!"Unknown size"); NO_WAY("Target doesn't support TYP_LCLBLK"); - // Keep prefast happy - __fallthrough; - #endif // FEATURE_FIXED_OUT_ARGS default: // This must be a primitive var. Fall out of switch statement @@ -3100,9 +3097,6 @@ unsigned Compiler::lvaLclExactSize(unsigned varNum) assert(!"Unknown size"); NO_WAY("Target doesn't support TYP_LCLBLK"); - // Keep prefast happy - __fallthrough; - #endif // FEATURE_FIXED_OUT_ARGS default: // This must be a primitive var. Fall out of switch statement @@ -3539,7 +3533,7 @@ void Compiler::lvaSortByRefCount() noway_assert(!"lvType not set correctly"); varDsc->lvType = TYP_INT; - __fallthrough; + FALLTHROUGH; default: varDsc->lvTracked = 0; @@ -3848,7 +3842,7 @@ void Compiler::lvaMarkLclRefs(GenTree* tree, BasicBlock* block, Statement* stmt, } // Not 0 or 1, fall through .... - __fallthrough; + FALLTHROUGH; default: @@ -5628,7 +5622,7 @@ int Compiler::lvaAssignVirtualFrameOffsetToArg(unsigned lclNum, { break; } - __fallthrough; + FALLTHROUGH; case TYP_DOUBLE: case TYP_LONG: @@ -5769,7 +5763,7 @@ int Compiler::lvaAssignVirtualFrameOffsetToArg(unsigned lclNum, if (!varDsc->lvStructDoubleAlign) break; - __fallthrough; + FALLTHROUGH; case TYP_DOUBLE: case TYP_LONG: diff --git a/src/coreclr/src/jit/lower.cpp b/src/coreclr/src/jit/lower.cpp index 32c4f30..6494b95 100644 --- a/src/coreclr/src/jit/lower.cpp +++ b/src/coreclr/src/jit/lower.cpp @@ -247,7 +247,7 @@ GenTree* Lowering::LowerNode(GenTree* node) LowerStoreSingleRegCallStruct(node->AsBlk()); break; } - __fallthrough; + FALLTHROUGH; case GT_STORE_DYN_BLK: LowerBlockStoreCommon(node->AsBlk()); break; @@ -307,7 +307,7 @@ GenTree* Lowering::LowerNode(GenTree* node) case GT_STORE_LCL_VAR: WidenSIMD12IfNecessary(node->AsLclVarCommon()); - __fallthrough; + FALLTHROUGH; case GT_STORE_LCL_FLD: LowerStoreLocCommon(node->AsLclVarCommon()); @@ -3300,7 +3300,7 @@ void Lowering::LowerRetStruct(GenTreeUnOp* ret) case GT_OBJ: retVal->ChangeOper(GT_IND); - __fallthrough; + FALLTHROUGH; case GT_IND: retVal->ChangeType(nativeReturnType); LowerIndir(retVal->AsIndir()); @@ -6278,6 +6278,7 @@ void Lowering::ContainCheckNode(GenTree* node) break; case GT_STOREIND: ContainCheckStoreIndir(node->AsIndir()); + break; case GT_IND: ContainCheckIndir(node->AsIndir()); break; diff --git a/src/coreclr/src/jit/lowerxarch.cpp b/src/coreclr/src/jit/lowerxarch.cpp index 2a8826d..8b72275 100644 --- a/src/coreclr/src/jit/lowerxarch.cpp +++ b/src/coreclr/src/jit/lowerxarch.cpp @@ -1008,7 +1008,7 @@ void Lowering::LowerHWIntrinsic(GenTreeHWIntrinsic* node) break; } - __fallthrough; + FALLTHROUGH; } case NI_SSE_CompareGreaterThan: @@ -1728,7 +1728,7 @@ void Lowering::LowerHWIntrinsicCreate(GenTreeHWIntrinsic* node) BlockRange().InsertAfter(tmp2, tmp1); LowerNode(tmp1); - __fallthrough; + FALLTHROUGH; } case TYP_SHORT: @@ -1765,7 +1765,7 @@ void Lowering::LowerHWIntrinsicCreate(GenTreeHWIntrinsic* node) BlockRange().InsertAfter(tmp2, tmp1); LowerNode(tmp1); - __fallthrough; + FALLTHROUGH; } case TYP_INT: @@ -5594,6 +5594,7 @@ void Lowering::ContainCheckHWIntrinsic(GenTreeHWIntrinsic* node) } } } + break; } case HW_Category_IMM: diff --git a/src/coreclr/src/jit/lsraarm.cpp b/src/coreclr/src/jit/lsraarm.cpp index 8402bcd..ad345d9 100644 --- a/src/coreclr/src/jit/lsraarm.cpp +++ b/src/coreclr/src/jit/lsraarm.cpp @@ -226,7 +226,7 @@ int LinearScan::BuildNode(GenTree* tree) { return 0; } - __fallthrough; + FALLTHROUGH; case GT_LCL_FLD: { @@ -251,7 +251,7 @@ int LinearScan::BuildNode(GenTree* tree) { dstCount = compiler->lvaGetDesc(tree->AsLclVar()->GetLclNum())->lvFieldCnt; } - __fallthrough; + FALLTHROUGH; case GT_STORE_LCL_FLD: srcCount = BuildStoreLoc(tree->AsLclVarCommon()); @@ -365,7 +365,7 @@ int LinearScan::BuildNode(GenTree* tree) break; } - __fallthrough; + FALLTHROUGH; case GT_AND: case GT_OR: @@ -404,7 +404,7 @@ int LinearScan::BuildNode(GenTree* tree) setInternalRegsDelayFree = true; buildInternalIntRegisterDefForNode(tree); } - __fallthrough; + FALLTHROUGH; case GT_DIV: case GT_MULHI: @@ -477,7 +477,7 @@ int LinearScan::BuildNode(GenTree* tree) buildInternalIntRegisterDefForNode(tree); buildInternalIntRegisterDefForNode(tree); } - __fallthrough; + FALLTHROUGH; case GT_CNS_INT: { @@ -701,7 +701,8 @@ int LinearScan::BuildNode(GenTree* tree) // that overlaps with all the source registers. assert(!"Should never see GT_NULLCHECK on Arm/32"); #endif - // For Arm64 we simply fall through to the GT_IND case, and will use REG_ZR as the target. + // For Arm64 we simply fall through to the GT_IND case, and will use REG_ZR as the target. + FALLTHROUGH; case GT_IND: assert(dstCount == (tree->OperIs(GT_NULLCHECK) ? 0 : 1)); srcCount = BuildIndir(tree->AsIndir()); diff --git a/src/coreclr/src/jit/lsraarm64.cpp b/src/coreclr/src/jit/lsraarm64.cpp index b8a7415..9c67a05 100644 --- a/src/coreclr/src/jit/lsraarm64.cpp +++ b/src/coreclr/src/jit/lsraarm64.cpp @@ -83,7 +83,7 @@ int LinearScan::BuildNode(GenTree* tree) { return 0; } - __fallthrough; + FALLTHROUGH; case GT_LCL_FLD: { @@ -108,7 +108,7 @@ int LinearScan::BuildNode(GenTree* tree) { dstCount = compiler->lvaGetDesc(tree->AsLclVar()->GetLclNum())->lvFieldCnt; } - __fallthrough; + FALLTHROUGH; case GT_STORE_LCL_FLD: srcCount = BuildStoreLoc(tree->AsLclVarCommon()); @@ -159,7 +159,7 @@ int LinearScan::BuildNode(GenTree* tree) buildInternalRegisterUses(); } } - __fallthrough; + FALLTHROUGH; case GT_CNS_INT: { @@ -266,7 +266,7 @@ int LinearScan::BuildNode(GenTree* tree) assert(tree->gtGetOp1()->TypeGet() == tree->gtGetOp2()->TypeGet()); } - __fallthrough; + FALLTHROUGH; case GT_AND: case GT_OR: @@ -304,7 +304,7 @@ int LinearScan::BuildNode(GenTree* tree) buildInternalIntRegisterDefForNode(tree); setInternalRegsDelayFree = true; } - __fallthrough; + FALLTHROUGH; case GT_DIV: case GT_MULHI: @@ -905,7 +905,7 @@ int LinearScan::BuildSIMD(GenTreeSIMD* simdTree) case SIMDIntrinsicWiden: case SIMDIntrinsicInvalid: assert(!"These intrinsics should not be seen during register allocation"); - __fallthrough; + FALLTHROUGH; default: noway_assert(!"Unimplemented SIMD node type."); diff --git a/src/coreclr/src/jit/lsraxarch.cpp b/src/coreclr/src/jit/lsraxarch.cpp index 63f184a..02f739d 100644 --- a/src/coreclr/src/jit/lsraxarch.cpp +++ b/src/coreclr/src/jit/lsraxarch.cpp @@ -90,7 +90,7 @@ int LinearScan::BuildNode(GenTree* tree) { return 0; } - __fallthrough; + FALLTHROUGH; case GT_LCL_FLD: { @@ -323,7 +323,7 @@ int LinearScan::BuildNode(GenTree* tree) #if defined(TARGET_X86) case GT_MUL_LONG: dstCount = 2; - __fallthrough; + FALLTHROUGH; #endif case GT_MUL: case GT_MULHI: diff --git a/src/coreclr/src/jit/morph.cpp b/src/coreclr/src/jit/morph.cpp index 08b7bf03..87f695d 100644 --- a/src/coreclr/src/jit/morph.cpp +++ b/src/coreclr/src/jit/morph.cpp @@ -10054,7 +10054,7 @@ GenTree* Compiler::fgMorphPromoteLocalInitBlock(GenTreeLclVar* destLclNode, GenT // Promoted fields are expected to be "normalize on load". If that changes then // we may need to adjust this code to widen the constant correctly. assert(fieldDesc->lvNormalizeOnLoad()); - __fallthrough; + FALLTHROUGH; case TYP_INT: { int64_t mask = (int64_t(1) << (genTypeSize(dest->TypeGet()) * 8)) - 1; @@ -12230,7 +12230,7 @@ GenTree* Compiler::fgMorphSmpOp(GenTree* tree, MorphAddrContext* mac) } } - __fallthrough; + FALLTHROUGH; case GT_GT: { @@ -14291,6 +14291,7 @@ DONE_MORPHING_CHILDREN: return tree; } + break; default: break; @@ -16018,7 +16019,7 @@ bool Compiler::fgFoldConditional(BasicBlock* block) newMaxWeight = bUpdated->bbWeight; newMinWeight = min(edge->edgeWeightMin(), newMaxWeight); edge->setEdgeWeights(newMinWeight, newMaxWeight); - __fallthrough; + FALLTHROUGH; case BBJ_ALWAYS: edge = fgGetPredForBlock(bUpdated->bbJumpDest, bUpdated); diff --git a/src/coreclr/src/jit/objectalloc.cpp b/src/coreclr/src/jit/objectalloc.cpp index 39c22e6..e41a611 100644 --- a/src/coreclr/src/jit/objectalloc.cpp +++ b/src/coreclr/src/jit/objectalloc.cpp @@ -662,7 +662,7 @@ bool ObjectAllocator::CanLclVarEscapeViaParentStack(ArrayStack* parent canLclVarEscapeViaParentStack = false; break; } - __fallthrough; + FALLTHROUGH; case GT_COLON: case GT_QMARK: case GT_ADD: @@ -768,7 +768,7 @@ void ObjectAllocator::UpdateAncestorTypes(GenTree* tree, ArrayStack* p // Left child of GT_COMMA, it will be discarded break; } - __fallthrough; + FALLTHROUGH; case GT_COLON: case GT_QMARK: case GT_ADD: diff --git a/src/coreclr/src/jit/optcse.cpp b/src/coreclr/src/jit/optcse.cpp index b2c7005..2a3d722 100644 --- a/src/coreclr/src/jit/optcse.cpp +++ b/src/coreclr/src/jit/optcse.cpp @@ -3633,6 +3633,7 @@ bool Compiler::optIsCSEcandidate(GenTree* tree) { return false; } + return true; case GT_EQ: case GT_NE: diff --git a/src/coreclr/src/jit/optimizer.cpp b/src/coreclr/src/jit/optimizer.cpp index e5e664d..240e0c5 100644 --- a/src/coreclr/src/jit/optimizer.cpp +++ b/src/coreclr/src/jit/optimizer.cpp @@ -489,7 +489,7 @@ void Compiler::optUpdateLoopsBeforeRemoveBlock(BasicBlock* block, bool skipUnmar break; } - __fallthrough; + FALLTHROUGH; case BBJ_ALWAYS: noway_assert(block->bbJumpDest); @@ -550,7 +550,7 @@ void Compiler::optUpdateLoopsBeforeRemoveBlock(BasicBlock* block, bool skipUnmar break; } - __fallthrough; + FALLTHROUGH; case BBJ_ALWAYS: noway_assert(auxBlock->bbJumpDest); @@ -1392,7 +1392,7 @@ void Compiler::optCheckPreds() { break; } - __fallthrough; + FALLTHROUGH; case BBJ_NONE: noway_assert(blockPred->bbNext == block); break; @@ -3207,7 +3207,7 @@ bool Compiler::optComputeLoopRep(int constInit, { case GT_SUB: iterInc = -iterInc; - __fallthrough; + FALLTHROUGH; case GT_ADD: if (constInitX != constLimitX) @@ -3254,7 +3254,7 @@ bool Compiler::optComputeLoopRep(int constInit, { case GT_SUB: iterInc = -iterInc; - __fallthrough; + FALLTHROUGH; case GT_ADD: if (constInitX < constLimitX) @@ -3301,7 +3301,7 @@ bool Compiler::optComputeLoopRep(int constInit, { case GT_SUB: iterInc = -iterInc; - __fallthrough; + FALLTHROUGH; case GT_ADD: if (constInitX <= constLimitX) @@ -3348,7 +3348,7 @@ bool Compiler::optComputeLoopRep(int constInit, { case GT_SUB: iterInc = -iterInc; - __fallthrough; + FALLTHROUGH; case GT_ADD: if (constInitX > constLimitX) @@ -3395,7 +3395,7 @@ bool Compiler::optComputeLoopRep(int constInit, { case GT_SUB: iterInc = -iterInc; - __fallthrough; + FALLTHROUGH; case GT_ADD: if (constInitX >= constLimitX) @@ -5780,7 +5780,7 @@ bool Compiler::optNarrowTree(GenTree* tree, var_types srct, var_types dstt, Valu noway_assert(doit == false); return false; } - __fallthrough; + FALLTHROUGH; case GT_OR: case GT_XOR: @@ -7522,7 +7522,7 @@ void Compiler::fgCreateLoopPreHeader(unsigned lnum) noway_assert(predBlock->bbJumpDest != top); break; } - __fallthrough; + FALLTHROUGH; case BBJ_ALWAYS: case BBJ_EHCATCHRET: @@ -7561,6 +7561,7 @@ void Compiler::fgCreateLoopPreHeader(unsigned lnum) preHead->bbFlags |= BBF_JMP_TARGET | BBF_HAS_LABEL; } } while (++jumpTab, --jumpCnt); + break; default: noway_assert(!"Unexpected bbJumpKind"); diff --git a/src/coreclr/src/jit/simdashwintrinsic.cpp b/src/coreclr/src/jit/simdashwintrinsic.cpp index c9bdccb..f4f9ec9 100644 --- a/src/coreclr/src/jit/simdashwintrinsic.cpp +++ b/src/coreclr/src/jit/simdashwintrinsic.cpp @@ -556,6 +556,7 @@ GenTree* Compiler::impSimdAsHWIntrinsicSpecial(NamedIntrinsic intrinsic, break; } } + break; } case 1: diff --git a/src/coreclr/src/jit/simdcodegenxarch.cpp b/src/coreclr/src/jit/simdcodegenxarch.cpp index 4045c9b..f1bafb9 100644 --- a/src/coreclr/src/jit/simdcodegenxarch.cpp +++ b/src/coreclr/src/jit/simdcodegenxarch.cpp @@ -105,7 +105,7 @@ instruction CodeGen::getOpForSIMDIntrinsic(SIMDIntrinsicID intrinsicId, var_type } // For SSE, SIMDIntrinsicInit uses the same instruction as the SIMDIntrinsicShuffleSSE2 intrinsic. - __fallthrough; + FALLTHROUGH; case SIMDIntrinsicShuffleSSE2: if (baseType == TYP_FLOAT) diff --git a/src/coreclr/src/jit/valuenum.cpp b/src/coreclr/src/jit/valuenum.cpp index bf0dffa..eb357dd 100644 --- a/src/coreclr/src/jit/valuenum.cpp +++ b/src/coreclr/src/jit/valuenum.cpp @@ -3408,7 +3408,7 @@ ValueNum ValueNumStore::EvalUsingMathIdentity(var_types typ, VNFunc func, ValueN break; } // (x == x) == true (integer only) - __fallthrough; + FALLTHROUGH; case GT_GE: case GT_LE: // (x <= x) == true (integer only) @@ -3456,7 +3456,7 @@ ValueNum ValueNumStore::EvalUsingMathIdentity(var_types typ, VNFunc func, ValueN // (x < 0) == false // (x < x) == false std::swap(arg0VN, arg1VN); - __fallthrough; + FALLTHROUGH; case VNF_GT_UN: // (0 > x) == false // (x > x) == false @@ -3474,7 +3474,7 @@ ValueNum ValueNumStore::EvalUsingMathIdentity(var_types typ, VNFunc func, ValueN // (x >= 0) == true // (x >= x) == true std::swap(arg0VN, arg1VN); - __fallthrough; + FALLTHROUGH; case VNF_LE_UN: // (0 <= x) == true // (x <= x) == true @@ -7378,7 +7378,7 @@ void Compiler::fgValueNumberTree(GenTree* tree) break; case GT_BLK: - __fallthrough; + FALLTHROUGH; case GT_IND: { @@ -9902,7 +9902,7 @@ void Compiler::fgValueNumberAddExceptionSet(GenTree* tree) // Don't add exception set on LHS of assignment break; } - __fallthrough; + FALLTHROUGH; case GT_BLK: case GT_OBJ: diff --git a/src/coreclr/src/jit/valuenum.h b/src/coreclr/src/jit/valuenum.h index 2f57b63..26b9fd5 100644 --- a/src/coreclr/src/jit/valuenum.h +++ b/src/coreclr/src/jit/valuenum.h @@ -742,7 +742,7 @@ private: { case TYP_REF: assert(0 <= offset && offset <= 1); // Null or exception. - __fallthrough; + FALLTHROUGH; case TYP_BYREF: @@ -752,7 +752,7 @@ private: #endif // _MSC_VER - __fallthrough; + FALLTHROUGH; case TYP_INT: case TYP_LONG: diff --git a/src/coreclr/src/md/compiler/custattr_emit.cpp b/src/coreclr/src/md/compiler/custattr_emit.cpp index cff1be1..47589f9 100644 --- a/src/coreclr/src/md/compiler/custattr_emit.cpp +++ b/src/coreclr/src/md/compiler/custattr_emit.cpp @@ -1315,6 +1315,7 @@ HRESULT RegMeta::_HandleKnownCustomAttribute( // S_OK or error. // Force to wider value. qArgs[0].val.u4 = (unsigned)qArgs[0].val.i2; // Fall through to validation. + FALLTHROUGH; case CA_MethodImplAttribute3: // Validate bits. if (qArgs[0].val.u4 & ~(miUserMask)) @@ -1323,6 +1324,7 @@ HRESULT RegMeta::_HandleKnownCustomAttribute( // S_OK or error. if (!qNamedArgs[MI_CodeType].val.type.tag) break; // fall through to set the code type. + FALLTHROUGH; case CA_MethodImplAttribute1: { USHORT usFlags = reinterpret_cast(pRow)->GetImplFlags(); @@ -1338,6 +1340,7 @@ HRESULT RegMeta::_HandleKnownCustomAttribute( // S_OK or error. // Force the U2 to a wider U4 value explicitly. qArgs[0].val.u4 = qArgs[0].val.u2; // Fall through to handle the CA. + FALLTHROUGH; case CA_MarshalAsAttribute2: IfFailGo(_HandleNativeTypeCustomAttribute(tkObj, qArgs.Ptr(), qNamedArgs.Ptr(), qNativeType)); break; @@ -1351,6 +1354,7 @@ HRESULT RegMeta::_HandleKnownCustomAttribute( // S_OK or error. // Convert the I2 to a U2, then wide to an I4, then fall through. qArgs[0].val.i4 = static_cast(static_cast(qArgs[0].val.i2)); } + FALLTHROUGH; case CA_StructLayoutAttribute2: { // Get a copy of the flags to work with. diff --git a/src/coreclr/src/md/enc/stgio.cpp b/src/coreclr/src/md/enc/stgio.cpp index 451ee25..887f478 100644 --- a/src/coreclr/src/md/enc/stgio.cpp +++ b/src/coreclr/src/md/enc/stgio.cpp @@ -358,6 +358,8 @@ void StgIO::Close() break; } + FALLTHROUGH; + case STGIO_MEM: case STGIO_HFILEMEM: if (m_bFreeMem && m_pBaseData) @@ -366,6 +368,7 @@ void StgIO::Close() m_pBaseData = m_pData = 0; } // Intentional fall through to file case, if we kept handle open. + FALLTHROUGH; case STGIO_HFILE: { diff --git a/src/coreclr/src/pal/inc/pal.h b/src/coreclr/src/pal/inc/pal.h index 727522c..87d489c 100644 --- a/src/coreclr/src/pal/inc/pal.h +++ b/src/coreclr/src/pal/inc/pal.h @@ -191,6 +191,18 @@ typedef PVOID NATIVE_LIBRARY_HANDLE; #endif #endif +#ifndef __has_cpp_attribute +#define __has_cpp_attribute(x) (0) +#endif + +#ifndef FALLTHROUGH +#if __has_cpp_attribute(fallthrough) +#define FALLTHROUGH [[fallthrough]] +#else // __has_cpp_attribute(fallthrough) +#define FALLTHROUGH +#endif // __has_cpp_attribute(fallthrough) +#endif // FALLTHROUGH + #ifndef PAL_STDCPP_COMPAT #if __GNUC__ diff --git a/src/coreclr/src/pal/inc/rt/sal.h b/src/coreclr/src/pal/inc/rt/sal.h index 9f7c014..88991ce 100644 --- a/src/coreclr/src/pal/inc/rt/sal.h +++ b/src/coreclr/src/pal/inc/rt/sal.h @@ -2339,7 +2339,7 @@ typedef struct __F_ __F_; __blocksOn(resource) f : Function f blocks on the resource 'resource'. - __fallthrough : + FALLTHROUGH : Annotates switch statement labels where fall-through is desired, to distinguish from forgotten break statements. @@ -2586,8 +2586,6 @@ extern "C" { #define __inner_override _SA_annotes0(__override) #define __inner_callback _SA_annotes0(__callback) #define __inner_blocksOn(resource) _SA_annotes1(SAL_blocksOn, resource) - #define __inner_fallthrough_dec __inline __nothrow void __FallThrough() {} - #define __inner_fallthrough __FallThrough(); #define __post_except_maybenull __post __inner_exceptthat _Maybenull_impl_ #define __pre_except_maybenull __pre __inner_exceptthat _Maybenull_impl_ @@ -2626,8 +2624,6 @@ extern "C" { #define __inner_override #define __inner_callback #define __inner_blocksOn(resource) - #define __inner_fallthrough_dec - #define __inner_fallthrough #define __refparam #define __inner_control_entrypoint(category) #define __inner_data_entrypoint(category) @@ -2873,8 +2869,11 @@ of each annotation, see the advanced annotations section. #define __on_failure(annotes) _On_failure_impl_(annotes _SAL_nop_impl_) #ifndef __fallthrough // [ - __inner_fallthrough_dec - #define __fallthrough __inner_fallthrough +#if __has_cpp_attribute(fallthrough) +#define __fallthrough [[fallthrough]] +#else +#define __fallthrough +#endif #endif // ] #ifndef __analysis_assume // [ diff --git a/src/coreclr/src/pal/inc/rt/specstrings_undef.h b/src/coreclr/src/pal/inc/rt/specstrings_undef.h index 0008f22..b0e1848 100644 --- a/src/coreclr/src/pal/inc/rt/specstrings_undef.h +++ b/src/coreclr/src/pal/inc/rt/specstrings_undef.h @@ -336,8 +336,6 @@ #undef __inner_data_entrypoint #undef __inner_data_source #undef __inner_encoded -#undef __inner_fallthrough -#undef __inner_fallthrough_dec #undef __inner_nonvolatile #undef __inner_out_validated #undef __inner_override diff --git a/src/coreclr/src/pal/src/include/pal/palinternal.h b/src/coreclr/src/pal/src/include/pal/palinternal.h index a672d7c..e73720b 100644 --- a/src/coreclr/src/pal/src/include/pal/palinternal.h +++ b/src/coreclr/src/pal/src/include/pal/palinternal.h @@ -729,4 +729,10 @@ const char StackOverflowMessage[] = "Stack overflow.\n"; #endif // __cplusplus +#if __has_cpp_attribute(fallthrough) +#define FALLTHROUGH [[fallthrough]] +#else +#define FALLTHROUGH +#endif + #endif /* _PAL_INTERNAL_H_ */ diff --git a/src/coreclr/src/pal/src/libunwind/CMakeLists.txt b/src/coreclr/src/pal/src/libunwind/CMakeLists.txt index bf26aca..ffb74a0 100644 --- a/src/coreclr/src/pal/src/libunwind/CMakeLists.txt +++ b/src/coreclr/src/pal/src/libunwind/CMakeLists.txt @@ -32,6 +32,7 @@ if(CLR_CMAKE_HOST_UNIX) # Disable warning due to incorrect format specifier in debugging printf via the Debug macro add_compile_options(-Wno-format -Wno-format-security) + add_compile_options(-Wno-implicit-fallthrough) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wno-header-guard) diff --git a/src/coreclr/src/pal/src/safecrt/input.inl b/src/coreclr/src/pal/src/safecrt/input.inl index 7b95193..54b6296 100644 --- a/src/coreclr/src/pal/src/safecrt/input.inl +++ b/src/coreclr/src/pal/src/safecrt/input.inl @@ -418,6 +418,7 @@ static int __check_float_string(size_t nFloatStrUsed, ++longone; /* NOBREAK */ } + FALLTHROUGH; case _T('w') : ++widechar; /* set widechar = 1 */ break; @@ -790,6 +791,7 @@ _END_SECURE_CRT_DEPRECATION_DISABLE case _T('i') : /* could be d, o, or x */ comchr = _T('d'); /* use as default */ + FALLTHROUGH; case _T('x'): @@ -844,6 +846,7 @@ x_incwidth: ++integer64; num64 = 0; #endif /* HOST_64BIT */ + FALLTHROUGH; case _T('o') : case _T('u') : case _T('d') : diff --git a/src/coreclr/src/pal/src/safecrt/output.inl b/src/coreclr/src/pal/src/safecrt/output.inl index 9f10dd6..9aab6e8 100644 --- a/src/coreclr/src/pal/src/safecrt/output.inl +++ b/src/coreclr/src/pal/src/safecrt/output.inl @@ -847,6 +847,7 @@ int __cdecl _output ( #endif /* _UNICODE */ /* fall into 'c' case */ + FALLTHROUGH; case _T('c'): { /* print a single character specified by int argument */ #ifdef _UNICODE @@ -930,6 +931,7 @@ int __cdecl _output ( if (!(flags & (FL_SHORT|FL_LONG|FL_WIDECHAR))) flags |= FL_SHORT; #endif /* _UNICODE */ + FALLTHROUGH; case _T('s'): { /* print a string -- */ @@ -1029,7 +1031,7 @@ int __cdecl _output ( case _T('A'): capexp = 1; /* capitalize exponent */ ch += _T('a') - _T('A'); /* convert format char to lower */ - /* DROP THROUGH */ + FALLTHROUGH; case _T('e'): case _T('f'): case _T('g'): @@ -1107,6 +1109,7 @@ int __cdecl _output ( flags |= FL_LONG; /* assume we're converting a long */ #endif /* !PTR_IS_INT */ /* DROP THROUGH to hex formatting */ + FALLTHROUGH; case _T('X'): /* unsigned upper hex output */ diff --git a/src/coreclr/src/pal/src/safecrt/safecrt_output_l.cpp b/src/coreclr/src/pal/src/safecrt/safecrt_output_l.cpp index 7f00651..a59bfaa 100644 --- a/src/coreclr/src/pal/src/safecrt/safecrt_output_l.cpp +++ b/src/coreclr/src/pal/src/safecrt/safecrt_output_l.cpp @@ -766,7 +766,7 @@ int __cdecl _output ( flags |= FL_WIDECHAR; /* ISO std. */ #endif /* _UNICODE */ /* fall into 'c' case */ - + FALLTHROUGH; case _T('c'): { /* print a single character specified by int argument */ #ifdef _UNICODE @@ -846,6 +846,7 @@ int __cdecl _output ( if (!(flags & (FL_SHORT|FL_LONG|FL_WIDECHAR))) flags |= FL_SHORT; #endif /* _UNICODE */ + FALLTHROUGH; case _T('s'): { /* print a string -- */ @@ -945,7 +946,7 @@ int __cdecl _output ( case _T('A'): capexp = 1; /* capitalize exponent */ ch += _T('a') - _T('A'); /* convert format char to lower */ - /* DROP THROUGH */ + FALLTHROUGH; case _T('e'): case _T('f'): case _T('g'): @@ -1014,6 +1015,7 @@ int __cdecl _output ( flags |= FL_LONG; /* assume we're converting a long */ #endif /* !PTR_IS_INT */ /* DROP THROUGH to hex formatting */ + FALLTHROUGH; case _T('X'): /* unsigned upper hex output */ diff --git a/src/coreclr/src/pal/src/thread/context.cpp b/src/coreclr/src/pal/src/thread/context.cpp index 8d53e80..5ee0308 100644 --- a/src/coreclr/src/pal/src/thread/context.cpp +++ b/src/coreclr/src/pal/src/thread/context.cpp @@ -811,6 +811,7 @@ DWORD CONTEXTGetExceptionCodeForSignal(const siginfo_t *siginfo, default: break; } + break; case SIGTRAP: switch (siginfo->si_code) { @@ -1093,6 +1094,7 @@ CONTEXT_GetThreadContextFromThreadState( } // Intentional fall-through, the AVX states are supersets of the FLOAT state + FALLTHROUGH; case x86_FLOAT_STATE64: if (lpContext->ContextFlags & CONTEXT_FLOATING_POINT & CONTEXT_AREA_MASK) diff --git a/src/coreclr/src/utilcode/ilformatter.cpp b/src/coreclr/src/utilcode/ilformatter.cpp index f22cb0a..9c8011d 100644 --- a/src/coreclr/src/utilcode/ilformatter.cpp +++ b/src/coreclr/src/utilcode/ilformatter.cpp @@ -242,7 +242,7 @@ void ILFormatter::formatInstrArgs(OpInfo op, OpArgsVal arg, OutString* out, size hr = meta->GetNameFromToken(mdType, &typeName); } } - // FALL THROUGH + FALLTHROUGH; case InlineType: { // FIX handle case if (TypeFromToken(arg.i) == mdtTypeSpec) MDUTF8CSTR name; @@ -400,7 +400,7 @@ const BYTE* ILFormatter::formatStatement(const BYTE* instrPtr, OutString* out) { case CEE_LDC_I4_7: case CEE_LDC_I4_8: inlineArg.i = op.getOpcode() - CEE_LDC_I4_0; - // FALL THROUGH + FALLTHROUGH; case CEE_LDC_I4: case CEE_LDC_I4_S: result << inlineArg.i; @@ -472,7 +472,7 @@ const BYTE* ILFormatter::formatStatement(const BYTE* instrPtr, OutString* out) { *lhs << '\n' << result; // put the result in front of anything else result.swap(*lhs); } - /* fall through */ + FALLTHROUGH; case CEE_BR_S: case CEE_BR: DO_BR: { @@ -621,7 +621,7 @@ const BYTE* ILFormatter::formatStatement(const BYTE* instrPtr, OutString* out) { case CEE_NEWOBJ: result << "new "; - // FALL THROUGH + FALLTHROUGH; case CEE_CALL: case CEE_CALLVIRT: { formatInstrArgs(op, inlineArg, &result); diff --git a/src/coreclr/src/utilcode/sstring.cpp b/src/coreclr/src/utilcode/sstring.cpp index 9ac89bc..a0017a5 100644 --- a/src/coreclr/src/utilcode/sstring.cpp +++ b/src/coreclr/src/utilcode/sstring.cpp @@ -861,7 +861,7 @@ void SString::ConvertToANSI(SString &s) const case REPRESENTATION_UTF8: // No direct conversion to ANSI ConvertToUnicode(); - // fall through + FALLTHROUGH; case REPRESENTATION_UNICODE: break; @@ -913,7 +913,7 @@ COUNT_T SString::ConvertToUTF8(SString &s) const case REPRESENTATION_ANSI: // No direct conversion from ANSI to UTF8 ConvertToUnicode(); - // fall through + FALLTHROUGH; case REPRESENTATION_UNICODE: break; @@ -2425,7 +2425,7 @@ const SString &SString::GetCompatibleString(const SString &s, SString &scratch, // We can't in general convert to ASCII, so try unicode. ConvertToUnicode(i); - // fall through + FALLTHROUGH; case REPRESENTATION_UNICODE: if (s.IsRepresentation(REPRESENTATION_UNICODE)) @@ -2484,7 +2484,7 @@ const SString &SString::GetCompatibleString(const SString &s, SString &scratch) // We can't in general convert to ASCII, so try unicode. ConvertToUnicode(); - // fall through + FALLTHROUGH; case REPRESENTATION_UNICODE: if (s.IsRepresentation(REPRESENTATION_UNICODE)) @@ -2762,6 +2762,7 @@ bool SString::DacGetUnicode(COUNT_T cBufChars, case REPRESENTATION_UTF8: iPage = CP_UTF8; + FALLTHROUGH; case REPRESENTATION_ASCII: case REPRESENTATION_ANSI: // iPage defaults to CP_ACP. diff --git a/src/coreclr/src/utilcode/util.cpp b/src/coreclr/src/utilcode/util.cpp index bcec17f..d9cdedb 100644 --- a/src/coreclr/src/utilcode/util.cpp +++ b/src/coreclr/src/utilcode/util.cpp @@ -1902,6 +1902,7 @@ HRESULT validateOneArg( { case ELEMENT_TYPE_VOID: if(bNoVoidAllowed) IfFailGo(VLDTR_E_SIG_BADVOID); + FALLTHROUGH; case ELEMENT_TYPE_BOOLEAN: case ELEMENT_TYPE_CHAR: @@ -1927,6 +1928,7 @@ HRESULT validateOneArg( break; case ELEMENT_TYPE_BYREF: //fallthru if(TypeFromToken(tk)==mdtFieldDef) IfFailGo(VLDTR_E_SIG_BYREFINFIELD); + FALLTHROUGH; case ELEMENT_TYPE_PINNED: case ELEMENT_TYPE_SZARRAY: // Validate the referenced type. @@ -1935,6 +1937,7 @@ HRESULT validateOneArg( case ELEMENT_TYPE_CMOD_OPT: case ELEMENT_TYPE_CMOD_REQD: bRepeat = TRUE; // go on validating, we're not done with this arg + FALLTHROUGH; case ELEMENT_TYPE_VALUETYPE: //fallthru case ELEMENT_TYPE_CLASS: // See if the token is missing. @@ -2120,6 +2123,7 @@ HRESULT validateTokenSig( if (!(ulCallConv & IMAGE_CEE_CS_CALLCONV_HASTHIS) && !IsMdStatic(dwFlags)) return VLDTR_E_MD_NOTTHISNOTSTATIC; // fall thru to callconv check; + FALLTHROUGH; case mdtMemberRef: if(i == IMAGE_CEE_CS_CALLCONV_FIELD) return validateOneArg(tk, &sig, NULL, pImport, TRUE); diff --git a/src/coreclr/src/vm/amd64/jitinterfaceamd64.cpp b/src/coreclr/src/vm/amd64/jitinterfaceamd64.cpp index 30ed321..e76b6d4 100644 --- a/src/coreclr/src/vm/amd64/jitinterfaceamd64.cpp +++ b/src/coreclr/src/vm/amd64/jitinterfaceamd64.cpp @@ -548,9 +548,7 @@ int WriteBarrierManager::UpdateEphemeralBounds(bool isRuntimeSuspended) stompWBCompleteActions |= SWB_ICACHE_FLUSH; } } - // - // INTENTIONAL FALL-THROUGH! - // + FALLTHROUGH; case WRITE_BARRIER_PREGROW64: #ifdef FEATURE_USE_SOFTWARE_WRITE_WATCH_FOR_GC_HEAP case WRITE_BARRIER_WRITE_WATCH_PREGROW64: diff --git a/src/coreclr/src/vm/callcounting.cpp b/src/coreclr/src/vm/callcounting.cpp index eaf18aa..c5dafd1 100644 --- a/src/coreclr/src/vm/callcounting.cpp +++ b/src/coreclr/src/vm/callcounting.cpp @@ -148,7 +148,7 @@ FORCEINLINE void CallCountingManager::CallCountingInfo::SetStage(Stage stage) case Stage::StubMayBeActive: _ASSERTE(m_callCountingStub != nullptr); - // fall through + FALLTHROUGH; case Stage::PendingCompletion: _ASSERTE(m_stage == Stage::StubIsNotActive || m_stage == Stage::StubMayBeActive); diff --git a/src/coreclr/src/vm/class.cpp b/src/coreclr/src/vm/class.cpp index 4cb1e71..69102ad 100644 --- a/src/coreclr/src/vm/class.cpp +++ b/src/coreclr/src/vm/class.cpp @@ -1376,6 +1376,7 @@ CorElementType EEClass::ComputeInternalCorElementTypeForValueType(MethodTable * // for creating a TI_STRUCT. case ELEMENT_TYPE_PTR: type = ELEMENT_TYPE_U; + FALLTHROUGH; case ELEMENT_TYPE_I: case ELEMENT_TYPE_U: diff --git a/src/coreclr/src/vm/compile.cpp b/src/coreclr/src/vm/compile.cpp index e762bb2..3f18c36 100644 --- a/src/coreclr/src/vm/compile.cpp +++ b/src/coreclr/src/vm/compile.cpp @@ -1455,7 +1455,7 @@ void CEECompileInfo::EncodeGenericSignature( case DeclaringTypeHandleSlot: EncodeTypeInDictionarySignature(pInfoModule, ptr, pSigBuilder, encodeContext, pfnEncodeModule); IfFailThrow(ptr.SkipExactlyOne()); - // fall through + FALLTHROUGH; case TypeHandleSlot: EncodeTypeInDictionarySignature(pInfoModule, ptr, pSigBuilder, encodeContext, pfnEncodeModule); @@ -1465,7 +1465,7 @@ void CEECompileInfo::EncodeGenericSignature( case ConstrainedMethodEntrySlot: EncodeTypeInDictionarySignature(pInfoModule, ptr, pSigBuilder, encodeContext, pfnEncodeModule); IfFailThrow(ptr.SkipExactlyOne()); - // fall through + FALLTHROUGH; case MethodDescSlot: case MethodEntrySlot: diff --git a/src/coreclr/src/vm/customattribute.cpp b/src/coreclr/src/vm/customattribute.cpp index b8fe16e..3dea560 100644 --- a/src/coreclr/src/vm/customattribute.cpp +++ b/src/coreclr/src/vm/customattribute.cpp @@ -919,6 +919,7 @@ FCIMPL7(void, COMCustomAttribute::GetPropertyOrFieldData, ReflectModuleBaseObjec { case SERIALIZATION_TYPE_TAGGED_OBJECT: *pType = g_pObjectClass->GetManagedClassObject(); + FALLTHROUGH; case SERIALIZATION_TYPE_TYPE: case SERIALIZATION_TYPE_STRING: *value = ArgSlotToObj(GetDataFromBlob( @@ -1424,6 +1425,7 @@ ARG_SLOT COMCustomAttribute::GetDataFromBlob(Assembly *pCtorAssembly, arrayType = (CorSerializationType)ELEMENT_TYPE_CLASS; // grab the array type and make a type handle for it nullTH = GetTypeHandleFromBlob(pCtorAssembly, arrayType, pBlob, endBlob, pModule); + FALLTHROUGH; } case SERIALIZATION_TYPE_TYPE: case SERIALIZATION_TYPE_STRING: diff --git a/src/coreclr/src/vm/dllimport.cpp b/src/coreclr/src/vm/dllimport.cpp index 9a99718..4a1f1a0 100644 --- a/src/coreclr/src/vm/dllimport.cpp +++ b/src/coreclr/src/vm/dllimport.cpp @@ -3202,7 +3202,7 @@ BOOL NDirect::MarshalingRequired( THROW_BAD_FORMAT(BFA_BAD_SIGNATURE, (Module*)pModule); #endif - /* Fall thru */ + FALLTHROUGH; case ELEMENT_TYPE_VALUETYPE: { diff --git a/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp b/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp index 3380865..346963d 100644 --- a/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp +++ b/src/coreclr/src/vm/eetoprofinterfaceimpl.cpp @@ -1677,6 +1677,7 @@ DWORD EtwRootKindToProfApiRootKind(EtwGCRootKind dwEtwRootKind) // the appropriate case below _ASSERTE(!"Unrecognized ETW root kind"); // Deliberately fall through to kEtwGCRootKindOther + FALLTHROUGH; case kEtwGCRootKindOther: return COR_PRF_GC_ROOT_OTHER; diff --git a/src/coreclr/src/vm/excep.cpp b/src/coreclr/src/vm/excep.cpp index a2f01b5..0b5a4ad 100644 --- a/src/coreclr/src/vm/excep.cpp +++ b/src/coreclr/src/vm/excep.cpp @@ -5874,21 +5874,21 @@ const BYTE *UnparseType(const BYTE *pType, DWORD& csig, StubLinker *psl) case ELEMENT_TYPE_U1: psl->EmitUtf8("unsigned "); - //fallthru + FALLTHROUGH; case ELEMENT_TYPE_I1: psl->EmitUtf8("byte"); break; case ELEMENT_TYPE_U2: psl->EmitUtf8("unsigned "); - //fallthru + FALLTHROUGH; case ELEMENT_TYPE_I2: psl->EmitUtf8("short"); break; case ELEMENT_TYPE_U4: psl->EmitUtf8("unsigned "); - //fallthru + FALLTHROUGH; case ELEMENT_TYPE_I4: psl->EmitUtf8("int"); break; @@ -5902,7 +5902,7 @@ const BYTE *UnparseType(const BYTE *pType, DWORD& csig, StubLinker *psl) case ELEMENT_TYPE_U8: psl->EmitUtf8("unsigned "); - //fallthru + FALLTHROUGH; case ELEMENT_TYPE_I8: psl->EmitUtf8("long"); break; diff --git a/src/coreclr/src/vm/exceptmacros.h b/src/coreclr/src/vm/exceptmacros.h index 60deb5a..7e3a058 100644 --- a/src/coreclr/src/vm/exceptmacros.h +++ b/src/coreclr/src/vm/exceptmacros.h @@ -534,7 +534,7 @@ VOID ThrowBadFormatWorkerT(UINT resID, T * pImgObj DEBUGARG(__in_z const char *c while(0) -#define THROW_BAD_FORMAT(resID, imgObj) THROW_BAD_FORMAT_MAYBE(FALSE, resID, imgObj) +#define THROW_BAD_FORMAT(resID, imgObj) do { THROW_BAD_FORMAT_MAYBE(FALSE, resID, imgObj); UNREACHABLE(); } while(0) // Conditional version of THROW_BAD_FORMAT. Do not use for new callsites. This is really meant to be a drop-in replacement diff --git a/src/coreclr/src/vm/fieldmarshaler.cpp b/src/coreclr/src/vm/fieldmarshaler.cpp index 47a0f26..6f114f2 100644 --- a/src/coreclr/src/vm/fieldmarshaler.cpp +++ b/src/coreclr/src/vm/fieldmarshaler.cpp @@ -251,6 +251,7 @@ bool IsFieldBlittable( break; case ELEMENT_TYPE_R4: isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_R4); + break; case ELEMENT_TYPE_R8: isBlittable = (nativeType == NATIVE_TYPE_DEFAULT) || (nativeType == NATIVE_TYPE_R8); break; diff --git a/src/coreclr/src/vm/genericdict.cpp b/src/coreclr/src/vm/genericdict.cpp index 37044ef..ea53be3 100644 --- a/src/coreclr/src/vm/genericdict.cpp +++ b/src/coreclr/src/vm/genericdict.cpp @@ -1065,7 +1065,7 @@ Dictionary::PopulateEntry( } IfFailThrow(ptr.SkipExactlyOne()); - // fall through + FALLTHROUGH; } case TypeHandleSlot: @@ -1116,7 +1116,7 @@ Dictionary::PopulateEntry( } IfFailThrow(ptr.SkipExactlyOne()); - // fall through + FALLTHROUGH; } case MethodDescSlot: diff --git a/src/coreclr/src/vm/invokeutil.cpp b/src/coreclr/src/vm/invokeutil.cpp index 44ef6b9..c80d876 100644 --- a/src/coreclr/src/vm/invokeutil.cpp +++ b/src/coreclr/src/vm/invokeutil.cpp @@ -1063,7 +1063,8 @@ void InvokeUtil::SetValidField(CorElementType fldType, pField->SetValuePtr(*target,valueptr); break; } - // drop through + FALLTHROUGH; + case ELEMENT_TYPE_FNPTR: valueptr = *valueObj != 0 ? GetIntPtrValue(*valueObj) : NULL; if (pField->IsStatic()) diff --git a/src/coreclr/src/vm/jitinterface.cpp b/src/coreclr/src/vm/jitinterface.cpp index 5d2a97d..06d8516 100644 --- a/src/coreclr/src/vm/jitinterface.cpp +++ b/src/coreclr/src/vm/jitinterface.cpp @@ -3326,7 +3326,7 @@ NoSpecialCase: _ASSERTE(pTemplateMD != NULL); sigBuilder.AppendElementType(ELEMENT_TYPE_INTERNAL); sigBuilder.AppendPointer(pTemplateMD->GetMethodTable()); - // fall through + FALLTHROUGH; case TypeHandleSlot: { @@ -3362,7 +3362,7 @@ NoSpecialCase: sigBuilder.AppendElementType(ELEMENT_TYPE_INTERNAL); sigBuilder.AppendPointer(pConstrainedResolvedToken->hClass); } - // fall through + FALLTHROUGH; case MethodDescSlot: case MethodEntrySlot: diff --git a/src/coreclr/src/vm/methodtablebuilder.cpp b/src/coreclr/src/vm/methodtablebuilder.cpp index 3270813..ec07edc 100644 --- a/src/coreclr/src/vm/methodtablebuilder.cpp +++ b/src/coreclr/src/vm/methodtablebuilder.cpp @@ -3893,6 +3893,7 @@ VOID MethodTableBuilder::InitializeFieldDescs(FieldDesc *pFieldDescList, dwR8Fields++; // Deliberate fall through... + FALLTHROUGH; } case ELEMENT_TYPE_I8: diff --git a/src/coreclr/src/vm/mlinfo.cpp b/src/coreclr/src/vm/mlinfo.cpp index 36b07ed..9a684a4 100644 --- a/src/coreclr/src/vm/mlinfo.cpp +++ b/src/coreclr/src/vm/mlinfo.cpp @@ -2052,12 +2052,14 @@ MarshalInfo::MarshalInfo(Module* pModule, case NATIVE_TYPE_STRUCT: m_resID = IDS_EE_OBJECT_TO_VARIANT_NOT_SUPPORTED; IfFailGoto(E_FAIL, lFail); + break; case NATIVE_TYPE_INTF: case NATIVE_TYPE_IUNKNOWN: case NATIVE_TYPE_IDISPATCH: m_resID = IDS_EE_OBJECT_TO_ITF_NOT_SUPPORTED; IfFailGoto(E_FAIL, lFail); + break; #endif // FEATURE_COMINTEROP case NATIVE_TYPE_ASANY: diff --git a/src/coreclr/src/vm/multicorejit.cpp b/src/coreclr/src/vm/multicorejit.cpp index 99f2489..1206b7f 100644 --- a/src/coreclr/src/vm/multicorejit.cpp +++ b/src/coreclr/src/vm/multicorejit.cpp @@ -987,6 +987,7 @@ HRESULT MulticoreJitRecorder::StartProfile(const WCHAR * pRoot, const WCHAR * pF case 'd': case 'D': g_MulticoreJitEnabled = false; + break; default: break; diff --git a/src/coreclr/src/vm/prestub.cpp b/src/coreclr/src/vm/prestub.cpp index 0e6c9ad..61eb9ae 100644 --- a/src/coreclr/src/vm/prestub.cpp +++ b/src/coreclr/src/vm/prestub.cpp @@ -3217,6 +3217,7 @@ PCODE DynamicHelperFixup(TransitionBlock * pTransitionBlock, TADDR * pCell, DWOR case ENCODE_ISINSTANCEOF_HELPER: case ENCODE_CHKCAST_HELPER: fReliable = true; + FALLTHROUGH; case ENCODE_NEW_ARRAY_HELPER: th = ZapSig::DecodeType(pModule, pInfoModule, pBlob); break; @@ -3243,6 +3244,7 @@ PCODE DynamicHelperFixup(TransitionBlock * pTransitionBlock, TADDR * pCell, DWOR // case ENCODE_VIRTUAL_ENTRY_REF_TOKEN: // case ENCODE_VIRTUAL_ENTRY_SLOT: fReliable = true; + FALLTHROUGH; case ENCODE_DELEGATE_CTOR: { pMD = ZapSig::DecodeMethod(pModule, pInfoModule, pBlob, &th); diff --git a/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp b/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp index 2de646b..f642ff1 100644 --- a/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/coreclr/src/vm/proftoeeinterfaceimpl.cpp @@ -1279,6 +1279,7 @@ void ScanRootsHelper(Object* pObj, Object ** ppRoot, ScanContext *pSC, uint32_t case kEtwGCRootKindHandle: _ASSERT(!"Shouldn't see handle here"); + break; case kEtwGCRootKindFinalizer: default: diff --git a/src/coreclr/src/vm/readytoruninfo.cpp b/src/coreclr/src/vm/readytoruninfo.cpp index 781530a..7f607c9 100644 --- a/src/coreclr/src/vm/readytoruninfo.cpp +++ b/src/coreclr/src/vm/readytoruninfo.cpp @@ -256,10 +256,12 @@ BOOL ReadyToRunInfo::GetEnclosingToken(IMDInternalImport * pImport, mdToken mdTy case mdtTypeRef: if (SUCCEEDED(pImport->GetResolutionScopeOfTypeRef(mdType, pEnclosingToken))) return ((TypeFromToken(*pEnclosingToken) == mdtTypeRef) && (*pEnclosingToken != mdTypeRefNil)); + break; case mdtExportedType: if (SUCCEEDED(pImport->GetExportedTypeProps(mdType, NULL, NULL, pEnclosingToken, NULL, NULL))) return ((TypeFromToken(*pEnclosingToken) == mdtExportedType) && (*pEnclosingToken != mdExportedTypeNil)); + break; } return FALSE; diff --git a/src/coreclr/src/vm/reflectioninvocation.cpp b/src/coreclr/src/vm/reflectioninvocation.cpp index 7b9da6c..19f70d5 100644 --- a/src/coreclr/src/vm/reflectioninvocation.cpp +++ b/src/coreclr/src/vm/reflectioninvocation.cpp @@ -1696,7 +1696,7 @@ FCIMPL5(void, RuntimeFieldHandle::SetValueDirect, ReflectFieldObject *pFieldUNSA break; } } - // drop through + FALLTHROUGH; case ELEMENT_TYPE_FNPTR: { value = 0; diff --git a/src/coreclr/src/vm/siginfo.cpp b/src/coreclr/src/vm/siginfo.cpp index 9e47853..34f2c6c 100644 --- a/src/coreclr/src/vm/siginfo.cpp +++ b/src/coreclr/src/vm/siginfo.cpp @@ -2437,7 +2437,8 @@ SigPointer::PeekElemTypeClosed( return type; } - // intentionally fall through + FALLTHROUGH; + case ELEMENT_TYPE_INTERNAL: { TypeHandle th; @@ -4068,6 +4069,7 @@ MetaSig::CompareElementType( } } // switch // Unreachable + UNREACHABLE(); } // MetaSig::CompareElementType #ifdef _PREFAST_ #pragma warning(pop) diff --git a/src/coreclr/src/vm/stubgen.cpp b/src/coreclr/src/vm/stubgen.cpp index d11d969..cee3cbe 100644 --- a/src/coreclr/src/vm/stubgen.cpp +++ b/src/coreclr/src/vm/stubgen.cpp @@ -2607,7 +2607,7 @@ void ILStubLinker::TransformArgForJIT(LocalDesc *pLoc) _ASSERTE(pLoc->InternalToken.IsBlittable()); break; } - // intentional fall-thru + FALLTHROUGH; } // pointers, byrefs, strings, arrays, other ref types -> ELEMENT_TYPE_I diff --git a/src/coreclr/src/vm/stubmgr.cpp b/src/coreclr/src/vm/stubmgr.cpp index 38f517c..f9477e4 100644 --- a/src/coreclr/src/vm/stubmgr.cpp +++ b/src/coreclr/src/vm/stubmgr.cpp @@ -1478,7 +1478,7 @@ BOOL RangeSectionStubManager::DoTraceStub(PCODE stubStartAddress, TraceDestinati } } - __fallthrough; + FALLTHROUGH; #endif case STUB_CODE_BLOCK_METHOD_CALL_THUNK: diff --git a/src/coreclr/src/vm/threads.cpp b/src/coreclr/src/vm/threads.cpp index 1c1cba7..ec4a113 100644 --- a/src/coreclr/src/vm/threads.cpp +++ b/src/coreclr/src/vm/threads.cpp @@ -2107,6 +2107,7 @@ HANDLE Thread::CreateUtilityThread(Thread::StackSizeBucket stackSizeBucket, LPTH default: _ASSERTE(!"Bad stack size bucket"); + break; case StackSize_Large: stackSize = 1024 * 1024; break; diff --git a/src/coreclr/src/vm/tieredcompilation.cpp b/src/coreclr/src/vm/tieredcompilation.cpp index 05fc673..509bf9b 100644 --- a/src/coreclr/src/vm/tieredcompilation.cpp +++ b/src/coreclr/src/vm/tieredcompilation.cpp @@ -937,12 +937,12 @@ CORJIT_FLAGS TieredCompilationManager::GetJitFlags(NativeCodeVersion nativeCodeV #ifdef FEATURE_ON_STACK_REPLACEMENT case NativeCodeVersion::OptimizationTier1OSR: flags.Set(CORJIT_FLAGS::CORJIT_FLAG_OSR); - // fall through + FALLTHROUGH; #endif case NativeCodeVersion::OptimizationTier1: flags.Set(CORJIT_FLAGS::CORJIT_FLAG_TIER1); - // fall through + FALLTHROUGH; case NativeCodeVersion::OptimizationTierOptimized: Optimized: diff --git a/src/coreclr/src/vm/typeparse.cpp b/src/coreclr/src/vm/typeparse.cpp index 007ef08..cba35a6 100644 --- a/src/coreclr/src/vm/typeparse.cpp +++ b/src/coreclr/src/vm/typeparse.cpp @@ -356,6 +356,7 @@ TypeName::TypeNameParser::TypeNameTokens TypeName::TypeNameParser::LexAToken(BOO case W('&'): return TypeNameAmpersand; case W('*'): return TypeNameAstrix; case W('+'): if (!ignorePlus) return TypeNamePlus; + FALLTHROUGH; case W('\\'): m_itr--; return TypeNameIdentifier; diff --git a/src/coreclr/src/vm/util.cpp b/src/coreclr/src/vm/util.cpp index 42a98ba..9cfe20d 100644 --- a/src/coreclr/src/vm/util.cpp +++ b/src/coreclr/src/vm/util.cpp @@ -743,6 +743,7 @@ ULONG NativeVarLocations(const ICorDebugInfo::VarLoc & varLoc, case ICorDebugInfo::VLT_REG_BYREF: fByRef = true; // fall through + FALLTHROUGH; case ICorDebugInfo::VLT_REG: regOffs = GetRegOffsInCONTEXT(varLoc.vlReg.vlrReg); locs->addr = (ULONG64)(ULONG_PTR)pCtx + regOffs; @@ -758,6 +759,7 @@ ULONG NativeVarLocations(const ICorDebugInfo::VarLoc & varLoc, case ICorDebugInfo::VLT_STK_BYREF: fByRef = true; // fall through + FALLTHROUGH; case ICorDebugInfo::VLT_STK: regOffs = GetRegOffsInCONTEXT(varLoc.vlStk.vlsBaseReg); baseReg = *(TADDR *)(regOffs + (BYTE*)pCtx); @@ -853,6 +855,7 @@ SIZE_T *NativeVarStackAddr(const ICorDebugInfo::VarLoc & varLoc, case ICorDebugInfo::VLT_REG_BYREF: fByRef = true; // fall through + FALLTHROUGH; case ICorDebugInfo::VLT_REG: regOffs = GetRegOffsInCONTEXT(varLoc.vlReg.vlrReg); dwAddr = (SIZE_T *)(regOffs + (BYTE*)pCtx); @@ -865,6 +868,7 @@ SIZE_T *NativeVarStackAddr(const ICorDebugInfo::VarLoc & varLoc, case ICorDebugInfo::VLT_STK_BYREF: fByRef = true; // fall through + FALLTHROUGH; case ICorDebugInfo::VLT_STK: regOffs = GetRegOffsInCONTEXT(varLoc.vlStk.vlsBaseReg); baseReg = (const BYTE *)*(SIZE_T *)(regOffs + (BYTE*)pCtx); diff --git a/src/coreclr/src/vm/zapsig.cpp b/src/coreclr/src/vm/zapsig.cpp index cfcd97d..c2ba0ac 100644 --- a/src/coreclr/src/vm/zapsig.cpp +++ b/src/coreclr/src/vm/zapsig.cpp @@ -419,6 +419,7 @@ BOOL ZapSig::GetSignatureForTypeHandle(TypeHandle handle, _ASSERTE(sigType == ELEMENT_TYPE_VALUETYPE); if (!handle.IsNativeValueType()) RETURN(FALSE); + FALLTHROUGH; } // fall-through case ELEMENT_TYPE_VALUETYPE: diff --git a/src/libraries/Native/Unix/CMakeLists.txt b/src/libraries/Native/Unix/CMakeLists.txt index 222d2e6..ff432bd 100644 --- a/src/libraries/Native/Unix/CMakeLists.txt +++ b/src/libraries/Native/Unix/CMakeLists.txt @@ -1,4 +1,6 @@ cmake_minimum_required(VERSION 3.6.2) +include(CheckCCompilerFlag) + if(CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) # CMake 3.14.5 contains bug fixes for iOS cmake_minimum_required(VERSION 3.14.5) @@ -30,6 +32,12 @@ add_compile_options(-Wno-cast-align) add_compile_options(-Wno-typedef-redefinition) add_compile_options(-Wno-c11-extensions) add_compile_options(-Wno-unknown-pragmas) + +check_c_compiler_flag(-Wimplicit-fallthrough COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH) +if (COMPILER_SUPPORTS_W_IMPLICIT_FALLTHROUGH) + add_compile_options(-Wimplicit-fallthrough) +endif() + add_compile_options(-I${CMAKE_CURRENT_SOURCE_DIR}/Common) add_compile_options(-I${CMAKE_CURRENT_BINARY_DIR}/Common) add_compile_options(-g) diff --git a/src/libraries/Native/Unix/Common/pal_utilities.h b/src/libraries/Native/Unix/Common/pal_utilities.h index 3c8f8cd..55f01e9 100644 --- a/src/libraries/Native/Unix/Common/pal_utilities.h +++ b/src/libraries/Native/Unix/Common/pal_utilities.h @@ -45,6 +45,12 @@ #define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0])) +#if __has_attribute(fallthrough) +#define FALLTHROUGH __attribute__((fallthrough)) +#else +#define FALLTHROUGH +#endif + /** * Abstraction helper method to safely copy strings using strlcpy or strcpy_s * or a different safe copy method, depending on the current platform. diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt index 3fbe16b..5bf46fe 100644 --- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt @@ -48,6 +48,9 @@ if (NOT CLR_CMAKE_TARGET_BROWSER) ../../AnyOS/brotli/enc/static_dict.c ../../AnyOS/brotli/enc/utf8_util.c ) + + # Disable implicit fallthrough warning for Brotli + set_source_files_properties(${NATIVECOMPRESSION_SOURCES} PROPERTIES COMPILE_FLAGS -Wno-implicit-fallthrough) endif() if (GEN_SHARED_LIB) diff --git a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c index 89240ec..fbdb530 100644 --- a/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c +++ b/src/libraries/Native/Unix/System.IO.Ports.Native/pal_termios.c @@ -495,7 +495,7 @@ int32_t SystemIoPortsNative_TermiosReset(intptr_t handle, int32_t speed, int32_t break; case HandshakeBoth: /* software & hardware flow control */ term.c_cflag |= CRTSCTS; - // fall through + FALLTHROUGH; case HandshakeSoft: /* XOn/XOff */ term.c_iflag |= IXOFF | IXON; break; -- 2.7.4