mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-14 15:43:45 +00:00
system: remove unused exception raising code (#25894)
...that otherwise causes an unnecessary raise effect on writeWindows /
echoBinSafe
(cherry picked from commit eaa4b342be)
This commit is contained in:
@@ -3064,10 +3064,7 @@ when notJSnotNims:
|
||||
not defined(nuttx) and
|
||||
hostOS != "any"
|
||||
|
||||
proc raiseEIO(msg: string) {.noinline, noreturn.} =
|
||||
raise newException(IOError, msg)
|
||||
|
||||
proc echoBinSafe(args: openArray[string]) {.compilerproc.} =
|
||||
proc echoBinSafe(args: openArray[string]) {.compilerproc, raises: [].} =
|
||||
when defined(androidNDK):
|
||||
# When running nim in android app, stdout goes nowhere, so echo gets ignored
|
||||
# To redirect echo to the android logcat, use -d:androidNDK
|
||||
@@ -3089,7 +3086,7 @@ when notJSnotNims:
|
||||
for s in args:
|
||||
when defined(windows):
|
||||
# equivalent to syncio.writeWindows
|
||||
proc writeWindows(f: CFilePtr; s: string; doRaise = false) =
|
||||
proc writeWindows(f: CFilePtr; s: string) =
|
||||
# Don't ask why but the 'printf' family of function is the only thing
|
||||
# that writes utf-8 strings reliably on Windows. At least on my Win 10
|
||||
# machine. We also enable `setConsoleOutputCP(65001)` now by default.
|
||||
@@ -3100,13 +3097,11 @@ when notJSnotNims:
|
||||
if s[i] == '\0':
|
||||
let w = c_fputc('\0', f)
|
||||
if w != 0:
|
||||
if doRaise: raiseEIO("cannot write string to file")
|
||||
break
|
||||
inc i
|
||||
else:
|
||||
let w = c_fprintf(f, "%s", unsafeAddr s[i])
|
||||
if w <= 0:
|
||||
if doRaise: raiseEIO("cannot write string to file")
|
||||
break
|
||||
inc i, w
|
||||
writeWindows(cstdout, s)
|
||||
|
||||
Reference in New Issue
Block a user