diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-07-31 22:14:15 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 22:14:15 +0800 |
commit | 0b3ddd4e47e12dda043a48ac24a8db823846d3da (patch) | |
tree | d74e85722645d906675c0f1b8e4f6c7e7b692fda | |
parent | b56df5c07f7dc9ac9d718ca47c10b0683a9b916f (diff) | |
download | Nim-0b3ddd4e47e12dda043a48ac24a8db823846d3da.tar.gz |
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.
-rw-r--r-- | compiler/ccgstmts.nim | 7 | ||||
-rw-r--r-- | compiler/extccomp.nim | 5 | ||||
-rw-r--r-- | testament/important_packages.nim | 2 |
3 files changed, 5 insertions, 9 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 448a437db..319738981 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 3605d1dd2..391f158f0 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 c632256ef..9016a0d3d 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" |