From 3929e2057d2f1c14d08ed086df0f6fcdc0b0311a Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Tue, 25 Jul 2023 23:31:05 +0200 Subject: [PATCH] Change unreachable code to error. Remove unreachable where the compiler now can detect reachability. --- lib/std/io/os/getcwd.c3 | 2 +- lib/std/math/math_nolibc/cos.c3 | 1 - lib/std/math/math_nolibc/sin.c3 | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/std/io/os/getcwd.c3 b/lib/std/io/os/getcwd.c3 index ba737fca5..961ab4f46 100644 --- a/lib/std/io/os/getcwd.c3 +++ b/lib/std/io/os/getcwd.c3 @@ -35,7 +35,7 @@ macro String! getcwd(Allocator* using = mem::heap()) return res.copy(using); $default: - unreachable("'getcwd' not available"); + return IoError.UNSUPPORTED_OPERATION?; $endswitch } diff --git a/lib/std/math/math_nolibc/cos.c3 b/lib/std/math/math_nolibc/cos.c3 index 76e59393c..7fefa946f 100644 --- a/lib/std/math/math_nolibc/cos.c3 +++ b/lib/std/math/math_nolibc/cos.c3 @@ -37,7 +37,6 @@ fn float _cosf(float x) @extern("cosf") @weak @nostrip case 2: return -__cosdf(y); default: return __sindf(y); } - unreachable(); } /* origin: FreeBSD /usr/src/lib/msun/src/s_cos.c */ diff --git a/lib/std/math/math_nolibc/sin.c3 b/lib/std/math/math_nolibc/sin.c3 index 6e7dc8f69..d895ca696 100644 --- a/lib/std/math/math_nolibc/sin.c3 +++ b/lib/std/math/math_nolibc/sin.c3 @@ -70,7 +70,6 @@ fn float _sinf(float x) @weak @extern("sinf") @nostrip case 2: return __sindf(-y); default: return -__cosdf(y); } - unreachable(); } /* origin: FreeBSD /usr/src/lib/msun/src/s_sin.c */