Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nimsuggest/#117 #15602

Merged
merged 1 commit into from
Nov 15, 2020
Merged

Fix nimsuggest/#117 #15602

merged 1 commit into from
Nov 15, 2020

Conversation

Clyybber
Copy link
Contributor

@alaviss
Copy link
Collaborator

alaviss commented Oct 17, 2020

Should add [backport:1.4] if this is accepted.

@alaviss
Copy link
Collaborator

alaviss commented Oct 17, 2020

Looks like the --backend switch triggers some magic like defining the symbols corresponding to the backend:

Nim/compiler/main.nim

Lines 178 to 201 in d66e274

proc customizeForBackend(backend: TBackend) =
## Sets backend specific options but don't compile to backend yet in
## case command doesn't require it. This must be called by all commands.
if conf.backend == backendInvalid:
# only set if wasn't already set, to allow override via `nim c -b:cpp`
conf.backend = backend
defineSymbol(graph.config.symbols, $conf.backend)
case conf.backend
of backendC:
if conf.exc == excNone: conf.exc = excSetjmp
of backendCpp:
if conf.exc == excNone: conf.exc = excCpp
of backendObjc: discard
of backendJs:
if conf.hcrOn:
# XXX: At the moment, system.nim cannot be compiled in JS mode
# with "-d:useNimRtl". The HCR option has been processed earlier
# and it has added this define implictly, so we must undo that here.
# A better solution might be to fix system.nim
undefSymbol(conf.symbols, "useNimRtl")
of backendInvalid: doAssert false
if conf.selectedGC in {gcArc, gcOrc} and conf.backend != backendCpp:
conf.exc = excGoto

And only the main compiler has it... We should move some of this over to the compiler library.

@alaviss
Copy link
Collaborator

alaviss commented Oct 17, 2020

/cc @timotheecour

@timotheecour
Copy link
Member

timotheecour commented Oct 18, 2020

hard to pinpoint where error started without git bisect but this commit also seems relevant: #15549

@Clyybber
Copy link
Contributor Author

Error disappeared after clearing nimcache, going to close this for now then.

@Clyybber
Copy link
Contributor Author

Clyybber commented Nov 15, 2020

@timotheecour Its caused by this change 9502e39#diff-2179cfe66f0e3b26b6475c540e7af193fcaef3ccad352b45f43ecb488e99cc8bL629, although arguably we could/should? prevent the call to externalFileChanged without a backend specified in the first place, but that is preexisting behaviour, improving that counts as an optimization.

@Clyybber Clyybber merged commit 92da06e into nim-lang:devel Nov 15, 2020
@Clyybber
Copy link
Contributor Author

@narimiran Should be backported to 1.4, LMK if I should make a PR for the 1.4 branch

narimiran pushed a commit that referenced this pull request Nov 16, 2020
(cherry picked from commit 92da06e)
PMunch pushed a commit to PMunch/Nim that referenced this pull request Jan 6, 2021
mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
irdassis pushed a commit to irdassis/Nim that referenced this pull request Mar 16, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nimsuggest crashes when run without a backend specified
3 participants