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

This commit is contained in:
Neelesh Chandola 2018-12-13 13:59:46 +05:30
commit b2411db541
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: if self.suggestMode:
conf.command = "nimsuggest" 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)= proc runNimScriptIfExists(path: AbsoluteFile)=
if fileExists(path): if fileExists(path):
runNimScript(cache, path, freshDefines = false, conf) 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 # 'nimsuggest foo.nims' means to just auto-complete the NimScript file
discard discard
# Reload configuration from .cfg file
loadConfigs(DefaultConfig, cache, conf)
# now process command line arguments again, because some options in the # now process command line arguments again, because some options in the
# command line can overwite the config file's settings # command line can overwite the config file's settings
extccomp.initVars(conf) extccomp.initVars(conf)

View file

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

View file

@ -800,11 +800,13 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode =
typ = commonType(typ, x.sons[1]) typ = commonType(typ, x.sons[1])
closeScope(c) closeScope(c)
of nkElse: of nkElse:
chckCovered = false
checkSonsLen(x, 1, c.config) checkSonsLen(x, 1, c.config)
x.sons[0] = semExprBranchScope(c, x.sons[0]) x.sons[0] = semExprBranchScope(c, x.sons[0])
typ = commonType(typ, x.sons[0]) typ = commonType(typ, x.sons[0])
hasElse = true 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: else:
illFormedAst(x, c.config) illFormedAst(x, c.config)
if chckCovered: if chckCovered:

View file

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

View file

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

View file

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

View file

@ -34,7 +34,7 @@ type
vccplatUWP = "uwp", ## Universal Windows Platform (UWP) Application vccplatUWP = "uwp", ## Universal Windows Platform (UWP) Application
vccplatOneCore = "onecore" # Undocumented platform type in the Windows SDK, probably XBox One SDK platform type. 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. ## 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 ## path
@ -50,7 +50,7 @@ proc vccVarsAll*(path: string, arch: VccArch = vccarchUnspecified, platform_type
var vccvarsallpath = path var vccvarsallpath = path
# Assume that default executable is in current directory or in PATH # Assume that default executable is in current directory or in PATH
if path == nil or path.len < 1: if path == "":
vccvarsallpath = vcvarsallDefaultPath vccvarsallpath = vcvarsallDefaultPath
var args: seq[string] = @[] var args: seq[string] = @[]