From 0b3ddd4e47e12dda043a48ac24a8db823846d3da Mon Sep 17 00:00:00 2001 From: ringabout <43030857+ringabout@users.noreply.github.com> Date: Mon, 31 Jul 2023 22:14:15 +0800 Subject: [PATCH] Revert "fixes #22246; generate `__builtin_unreachable` hints for case defaults" (#22351) Revert "fixes #22246; generate `__builtin_unreachable` hints for case defaults (#22350)" This reverts commit b56df5c07f7dc9ac9d718ca47c10b0683a9b916f. --- compiler/ccgstmts.nim | 7 ++----- compiler/extccomp.nim | 5 ++--- testament/important_packages.nim | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 448a437db7..3197389814 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -971,11 +971,8 @@ proc genOrdinalCase(p: BProc, n: PNode, d: var TLoc) = hasDefault = true exprBlock(p, branch.lastSon, d) lineF(p, cpsStmts, "break;$n", []) - if not hasDefault: - if hasBuiltinUnreachable in CC[p.config.cCompiler].props: - lineF(p, cpsStmts, "default: __builtin_unreachable();$n", []) - elif hasAssume in CC[p.config.cCompiler].props: - lineF(p, cpsStmts, "default: __assume(0);$n", []) + if (hasAssume in CC[p.config.cCompiler].props) and not hasDefault: + lineF(p, cpsStmts, "default: __assume(0);$n", []) lineF(p, cpsStmts, "}$n", []) if lend != "": fixLabel(p, lend) diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 3605d1dd27..391f158f0c 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -33,7 +33,6 @@ type hasGnuAsm, # CC's asm uses the absurd GNU assembler syntax hasDeclspec, # CC has __declspec(X) hasAttribute, # CC has __attribute__((X)) - hasBuiltinUnreachable # CC has __builtin_unreachable TInfoCCProps* = set[TInfoCCProp] TInfoCC* = tuple[ name: string, # the short name of the compiler @@ -96,7 +95,7 @@ compiler gcc: produceAsm: gnuAsmListing, cppXsupport: "-std=gnu++17 -funsigned-char", props: {hasSwitchRange, hasComputedGoto, hasCpp, hasGcGuard, hasGnuAsm, - hasAttribute, hasBuiltinUnreachable}) + hasAttribute}) # GNU C and C++ Compiler compiler nintendoSwitchGCC: @@ -123,7 +122,7 @@ compiler nintendoSwitchGCC: produceAsm: gnuAsmListing, cppXsupport: "-std=gnu++17 -funsigned-char", props: {hasSwitchRange, hasComputedGoto, hasCpp, hasGcGuard, hasGnuAsm, - hasAttribute, hasBuiltinUnreachable}) + hasAttribute}) # LLVM Frontend for GCC/G++ compiler llvmGcc: diff --git a/testament/important_packages.nim b/testament/important_packages.nim index c632256efe..9016a0d3dc 100644 --- a/testament/important_packages.nim +++ b/testament/important_packages.nim @@ -146,7 +146,7 @@ pkg "rosencrantz", "nim c -o:rsncntz -r rosencrantz.nim" pkg "sdl1", "nim c -r src/sdl.nim" pkg "sdl2_nim", "nim c -r sdl2/sdl.nim" pkg "sigv4", "nim c --gc:arc -r sigv4.nim", "https://github.com/disruptek/sigv4" -pkg "sim", url = "https://github.com/nim-lang/sim.nim" +pkg "sim" pkg "smtp", "nimble compileExample" pkg "snip", "nimble test", "https://github.com/genotrance/snip" pkg "ssostrings"