Skip to content

Commit 1cf5c28

Browse files
authored
only enable linenoise for -d:nimUseLinenoise (#13478)
* only enable linenoise for -d:nimUseLinenoise * fixup
1 parent 84e78b4 commit 1cf5c28

File tree

6 files changed

+13
-9
lines changed

6 files changed

+13
-9
lines changed

compiler/commands.nim

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ template bootSwitch(name, expr, userString) =
1818

1919
bootSwitch(usedRelease, defined(release), "-d:release")
2020
bootSwitch(usedDanger, defined(danger), "-d:danger")
21-
bootSwitch(usedGnuReadline, defined(useLinenoise), "-d:useLinenoise")
21+
# `useLinenoise` deprecated in favor of `nimUseLinenoise`, kept for backward compatibility
22+
bootSwitch(useLinenoise, defined(nimUseLinenoise) or defined(useLinenoise), "-d:nimUseLinenoise")
2223
bootSwitch(usedBoehm, defined(boehmgc), "--gc:boehm")
2324
bootSwitch(usedMarkAndSweep, defined(gcmarkandsweep), "--gc:markAndSweep")
2425
bootSwitch(usedGenerational, defined(gcgenerational), "--gc:generational")
@@ -101,7 +102,7 @@ proc writeVersionInfo(conf: ConfigRef; pass: TCmdLinePass) =
101102
msgWriteln(conf, "git hash: " & gitHash, {msgStdout})
102103

103104
msgWriteln(conf, "active boot switches:" & usedRelease & usedDanger &
104-
usedTinyC & usedGnuReadline & usedNativeStacktrace &
105+
usedTinyC & useLinenoise & usedNativeStacktrace &
105106
usedFFI & usedBoehm & usedMarkAndSweep & usedGenerational & usedGoGC & usedNoGC,
106107
{msgStdout})
107108
msgQuit(0)

compiler/llstream.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@
1212
import
1313
pathutils
1414

15-
template imp(x) = import x
16-
const hasRstdin = compiles(imp(rdstdin))
15+
# support `useGnuReadline`, `useLinenoise` for backwards compatibility
16+
const hasRstdin = (defined(nimUseLinenoise) or defined(useLinenoise) or defined(useGnuReadline)) and
17+
not defined(windows)
18+
1719
when hasRstdin: import rdstdin
1820

1921
type

doc/koch.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ options:
3535
By default a debug version is created, passing this option will
3636
force a release build, which is much faster and should be preferred
3737
unless you are debugging the compiler.
38-
-d:useLinenoise
38+
-d:nimUseLinenoise
3939
Use the linenoise library for interactive mode (not needed on Windows).
4040

4141
After compilation is finished you will hopefully end up with the nim

doc/nimc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ for further information.
528528
529529
The Nim compiler supports an interactive mode. This is also known as
530530
a `REPL`:idx: (*read eval print loop*). If Nim has been built with the
531-
``-d:useGnuReadline`` switch, it uses the GNU readline library for terminal
531+
``-d:nimUseLinenoise`` switch, it uses the GNU readline library for terminal
532532
input management. To start Nim in interactive mode use the command
533533
``nim secret``. To quit use the ``quit()`` command. To determine whether an input
534534
line is an incomplete statement to be continued these rules are used:

koch.nim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Possible Commands:
5555
nimble builds the Nimble tool
5656
Boot options:
5757
-d:release produce a release version of the compiler
58-
-d:useLinenoise use the linenoise library for interactive mode
59-
(not needed on Windows)
58+
-d:nimUseLinenoise use the linenoise library for interactive mode
59+
`nim secret` (not needed on Windows)
6060
-d:leanCompiler produce a compiler without JS codegen or
6161
documentation generator in order to use less RAM
6262
for bootstrapping

tools/niminst/niminst.nim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,8 @@ template gatherFiles(fun, libpath, outDir) =
513513
fun(src, dst)
514514

515515
for f in walkFiles(libpath / "lib/*.h"): copySrc(f)
516-
copySrc(libpath / "lib/wrappers/linenoise/linenoise.h")
516+
# commenting out for now, see discussion in https://github.com/nim-lang/Nim/pull/13413
517+
# copySrc(libpath / "lib/wrappers/linenoise/linenoise.h")
517518

518519
proc srcdist(c: var ConfigData) =
519520
let cCodeDir = getOutputDir(c) / "c_code"

0 commit comments

Comments
 (0)