the mainmodule option has effect only when no explicit module is given

This commit is contained in:
Zahary Karadjov 2013-01-28 00:26:49 +02:00
commit 19e795e017
5 changed files with 11 additions and 12 deletions

View file

@ -231,8 +231,7 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) =
options.outFile = arg options.outFile = arg
of "mainmodule", "m": of "mainmodule", "m":
expectArg(switch, arg, pass, info) expectArg(switch, arg, pass, info)
gProjectName = arg optMainModule = arg
gProjectFull = gProjectPath / gProjectName
of "define", "d": of "define", "d":
expectArg(switch, arg, pass, info) expectArg(switch, arg, pass, info)
DefineSymbol(arg) DefineSymbol(arg)

View file

@ -382,15 +382,14 @@ proc CommandSuggest =
proc wantMainModule = proc wantMainModule =
if gProjectFull.len == 0: if gProjectFull.len == 0:
if optMainModule.len == 0:
Fatal(gCmdLineInfo, errCommandExpectsFilename) Fatal(gCmdLineInfo, errCommandExpectsFilename)
else:
gProjectName = optMainModule
gProjectFull = gProjectPath / gProjectName
gProjectMainIdx = addFileExt(gProjectFull, nimExt).fileInfoIdx gProjectMainIdx = addFileExt(gProjectFull, nimExt).fileInfoIdx
var oss: PGenericSeq
proc dbgseqimp(x: PGenericSeq) {.cdecl.} =
oss = x
seqdbg = dbgseqimp
proc resetMemory = proc resetMemory =
resetCompilationLists() resetCompilationLists()
ccgutils.resetCaches() ccgutils.resetCaches()

View file

@ -99,7 +99,7 @@ var
gVerbosity*: int # how verbose the compiler is gVerbosity*: int # how verbose the compiler is
gNumberOfProcessors*: int # number of processors gNumberOfProcessors*: int # number of processors
gWholeProject*: bool # for 'doc2': output any dependency gWholeProject*: bool # for 'doc2': output any dependency
gEvalExpr*: string # expression for idetools --eval gEvalExpr* = "" # expression for idetools --eval
gLastCmdTime*: float # when caas is enabled, we measure each command gLastCmdTime*: float # when caas is enabled, we measure each command
gListFullPaths*: bool gListFullPaths*: bool
@ -124,6 +124,7 @@ var
gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/ gProjectPath* = "" # holds a path like /home/alice/projects/nimrod/compiler/
gProjectFull* = "" # projectPath/projectName gProjectFull* = "" # projectPath/projectName
gProjectMainIdx*: int32 # the canonical path id of the main module gProjectMainIdx*: int32 # the canonical path id of the main module
optMainModule* = "" # the main module that should be used for idetools commands
nimcacheDir* = "" nimcacheDir* = ""
command* = "" # the main command (e.g. cc, check, scan, etc) command* = "" # the main command (e.g. cc, check, scan, etc)
commandArgs*: seq[string] = @[] # any arguments after the main command commandArgs*: seq[string] = @[] # any arguments after the main command

View file

@ -81,7 +81,7 @@ const
# examined in the decref loop in collectCycles. # examined in the decref loop in collectCycles.
# XXX: not implemented yet as tests didn't show any improvement from this # XXX: not implemented yet as tests didn't show any improvement from this
MarkingSkipsAcyclicObjects = false MarkingSkipsAcyclicObjects = true
# Acyclic objects can be safely ignored in the mark and scan phases, # Acyclic objects can be safely ignored in the mark and scan phases,
# because they cannot contribute to the internal count. # because they cannot contribute to the internal count.
# XXX: if we generate specialized `markCyclic` and `markAcyclic` # XXX: if we generate specialized `markCyclic` and `markAcyclic`

View file

@ -1,6 +1,6 @@
discard """ discard """
file: "system.nim" file: "system.nim"
line: 669 line: 670
errormsg: "type mismatch" errormsg: "type mismatch"
""" """