Merge remote-tracking branch 'upstream/devel' into record-case

This commit is contained in:
Neelesh Chandola
2018-12-13 13:59:46 +05:30
7 changed files with 27 additions and 18 deletions

View File

@@ -48,6 +48,15 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
if self.suggestMode:
conf.command = "nimsuggest"
# These defines/options should not be enabled while processing nimscript
# bug #4446, #9420, #8991, #9589, #9153
undefSymbol(conf.symbols, "profiler")
undefSymbol(conf.symbols, "memProfiler")
undefSymbol(conf.symbols, "nodejs")
# bug #9120
conf.globalOptions.excl(optTaintMode)
proc runNimScriptIfExists(path: AbsoluteFile)=
if fileExists(path):
runNimScript(cache, path, freshDefines = false, conf)
@@ -79,6 +88,9 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
# 'nimsuggest foo.nims' means to just auto-complete the NimScript file
discard
# Reload configuration from .cfg file
loadConfigs(DefaultConfig, cache, conf)
# now process command line arguments again, because some options in the
# command line can overwite the config file's settings
extccomp.initVars(conf)

View File

@@ -780,7 +780,7 @@ proc linkViaResponseFile(conf: ConfigRef; cmd: string) =
let linkerArgs = conf.projectName & "_" & "linkerArgs.txt"
let args = cmd.substr(i)
# GCC's response files don't support backslashes. Junk.
if conf.cCompiler == ccGcc:
if conf.cCompiler == ccGcc or conf.cCompiler == ccCLang:
writeFile(linkerArgs, args.replace('\\', '/'))
else:
writeFile(linkerArgs, args)

View File

@@ -800,11 +800,13 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode =
typ = commonType(typ, x.sons[1])
closeScope(c)
of nkElse:
chckCovered = false
checkSonsLen(x, 1, c.config)
x.sons[0] = semExprBranchScope(c, x.sons[0])
typ = commonType(typ, x.sons[0])
hasElse = true
if chckCovered and covered == toCover(c, n.sons[0].typ):
localError(c.config, x.info, "invalid else, all cases are already covered")
chckCovered = false
else:
illFormedAst(x, c.config)
if chckCovered:

View File

@@ -219,7 +219,6 @@ when defined(Posix):
of AF_UNIX: result = posix.AF_UNIX
of AF_INET: result = posix.AF_INET
of AF_INET6: result = posix.AF_INET6
else: discard
proc toInt(typ: SockType): cint =
case typ
@@ -227,7 +226,6 @@ when defined(Posix):
of SOCK_DGRAM: result = posix.SOCK_DGRAM
of SOCK_SEQPACKET: result = posix.SOCK_SEQPACKET
of SOCK_RAW: result = posix.SOCK_RAW
else: discard
proc toInt(p: Protocol): cint =
case p
@@ -237,7 +235,6 @@ when defined(Posix):
of IPPROTO_IPV6: result = posix.IPPROTO_IPV6
of IPPROTO_RAW: result = posix.IPPROTO_RAW
of IPPROTO_ICMP: result = posix.IPPROTO_ICMP
else: discard
else:
proc toInt(domain: Domain): cint =
@@ -853,7 +850,6 @@ proc connect*(socket: Socket, address: string, port = Port(0),
of AF_UNIX: s.sin_family = posix.AF_UNIX
of AF_INET: s.sin_family = posix.AF_INET
of AF_INET6: s.sin_family = posix.AF_INET6
else: nil
if connect(socket.fd, cast[ptr TSockAddr](addr(s)), sizeof(s).cint) < 0'i32:
OSError()

View File

@@ -239,7 +239,6 @@ method testEnded*(formatter: ConsoleOutputFormatter, testResult: TestResult) =
of OK: fgGreen
of FAILED: fgRed
of SKIPPED: fgYellow
else: fgWhite
styledEcho styleBright, color, prefix, "[", $testResult.status, "] ", resetStyle, testResult.testName
else:
rawPrint()

View File

@@ -2,12 +2,12 @@ import strutils, strtabs, os, osproc, vcvarsall, vccenv
type
VccVersion* = enum ## VCC compiler backend versions
vccUndefined = (0, ""), ## VCC version undefined, resolves to the latest recognizable VCC version
vcc90 = vs90, ## Visual Studio 2008 (Version 9.0)
vcc100 = vs100, ## Visual Studio 2010 (Version 10.0)
vcc110 = vs110, ## Visual Studio 2012 (Version 11.0)
vcc120 = vs120, ## Visual Studio 2013 (Version 12.0)
vcc140 = vs140 ## Visual Studio 2015 (Version 14.0)
vccUndefined = 0, ## VCC version undefined, resolves to the latest recognizable VCC version
vcc90 = ord(vs90) ## Visual Studio 2008 (Version 9.0)
vcc100 = ord(vs100) ## Visual Studio 2010 (Version 10.0)
vcc110 = ord(vs110) ## Visual Studio 2012 (Version 11.0)
vcc120 = ord(vs120) ## Visual Studio 2013 (Version 12.0)
vcc140 = ord(vs140) ## Visual Studio 2015 (Version 14.0)
proc discoverVccVcVarsAllPath*(version: VccVersion = vccUndefined): string =
## Returns the path to the vcvarsall utility of the specified VCC compiler backend.
@@ -101,12 +101,12 @@ command was specified
when isMainModule:
var vccversionArg: seq[string] = @[]
var printPathArg: bool = false
var vcvarsallArg: string = nil
var commandArg: string = nil
var vcvarsallArg: string
var commandArg: string
var noCommandArg: bool = false
var platformArg: VccArch
var sdkTypeArg: VccPlatformType
var sdkVersionArg: string = nil
var sdkVersionArg: string
var verboseArg: bool = false
var clArgs: seq[TaintedString] = @[]

View File

@@ -34,7 +34,7 @@ type
vccplatUWP = "uwp", ## Universal Windows Platform (UWP) Application
vccplatOneCore = "onecore" # Undocumented platform type in the Windows SDK, probably XBox One SDK platform type.
proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type: VccPlatformType = vccplatEmpty, sdk_version: string = nil, verbose: bool = false): StringTableRef =
proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type: VccPlatformType = vccplatEmpty, sdk_version: string = "", verbose: bool = false): StringTableRef =
## Returns a string table containing the proper process environment to successfully execute VCC compile commands for the specified SDK version, CPU architecture and platform type.
##
## path
@@ -50,7 +50,7 @@ proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type
var vccvarsallpath = path
# Assume that default executable is in current directory or in PATH
if path == nil or path.len < 1:
if path == "":
vccvarsallpath = vcvarsallDefaultPath
var args: seq[string] = @[]