Merge branch 'devel' into araq-fixes-7833

This commit is contained in:
Araq 2018-08-04 20:11:25 +02:00
commit a18e40fa5f
5 changed files with 28 additions and 3 deletions

3
.gitignore vendored
View file

@ -58,6 +58,7 @@ dist/
.*/ .*/
~* ~*
# testament cruft # testament cruft; TODO: generate these in a gitignore'd dir in the first place.
testresults/ testresults/
test.txt test.txt
/test.ini

View file

@ -2127,7 +2127,7 @@ proc semSetConstr(c: PContext, n: PNode): PNode =
n.sons[i] = semExprWithType(c, n.sons[i]) n.sons[i] = semExprWithType(c, n.sons[i])
if typ == nil: if typ == nil:
typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyLent, tyOrdinal, tyAlias, tySink}) typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyLent, tyOrdinal, tyAlias, tySink})
if not isOrdinalType(typ): if not isOrdinalType(typ, allowEnumWithHoles=true):
localError(c.config, n.info, errOrdinalTypeExpected) localError(c.config, n.info, errOrdinalTypeExpected)
typ = makeRangeType(c, 0, MaxSetElements-1, n.info) typ = makeRangeType(c, 0, MaxSetElements-1, n.info)
elif lengthOrd(c.config, typ) > MaxSetElements: elif lengthOrd(c.config, typ) > MaxSetElements:

View file

@ -242,7 +242,15 @@ proc zip(args: string) =
exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim zip compiler/installer.ini" % exec("$# --var:version=$# --var:mingw=none --main:compiler/nim.nim zip compiler/installer.ini" %
["tools/niminst/niminst".exe, VersionAsString]) ["tools/niminst/niminst".exe, VersionAsString])
proc ensureCleanGit() =
let (outp, status) = osproc.execCmdEx("git diff")
if outp.len != 0:
quit "Not a clean git repository; 'git diff' not empty!"
if status != 0:
quit "Not a clean git repository; 'git diff' returned non-zero!"
proc xz(args: string) = proc xz(args: string) =
ensureCleanGit()
bundleNimbleSrc() bundleNimbleSrc()
bundleNimsuggest(false) bundleNimsuggest(false)
nimexec("cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" % nimexec("cc -r $2 --var:version=$1 --var:mingw=none --main:compiler/nim.nim scripts compiler/installer.ini" %

View file

@ -417,12 +417,18 @@ proc setStdIoUnbuffered() =
discard c_setvbuf(stdin, nil, IONBF, 0) discard c_setvbuf(stdin, nil, IONBF, 0)
when declared(stdout): when declared(stdout):
when defined(windows) and compileOption("threads"):
var echoLock: SysLock
initSysLock echoLock
proc echoBinSafe(args: openArray[string]) {.compilerProc.} = proc echoBinSafe(args: openArray[string]) {.compilerProc.} =
# flockfile deadlocks some versions of Android 5.x.x # flockfile deadlocks some versions of Android 5.x.x
when not defined(windows) and not defined(android) and not defined(nintendoswitch): when not defined(windows) and not defined(android) and not defined(nintendoswitch):
proc flockfile(f: File) {.importc, noDecl.} proc flockfile(f: File) {.importc, noDecl.}
proc funlockfile(f: File) {.importc, noDecl.} proc funlockfile(f: File) {.importc, noDecl.}
flockfile(stdout) flockfile(stdout)
when defined(windows) and compileOption("threads"):
acquireSys echoLock
for s in args: for s in args:
discard c_fwrite(s.cstring, s.len, 1, stdout) discard c_fwrite(s.cstring, s.len, 1, stdout)
const linefeed = "\n" # can be 1 or more chars const linefeed = "\n" # can be 1 or more chars
@ -430,5 +436,7 @@ when declared(stdout):
discard c_fflush(stdout) discard c_fflush(stdout)
when not defined(windows) and not defined(android) and not defined(nintendoswitch): when not defined(windows) and not defined(android) and not defined(nintendoswitch):
funlockfile(stdout) funlockfile(stdout)
when defined(windows) and compileOption("threads"):
releaseSys echoLock
{.pop.} {.pop.}

View file

@ -205,4 +205,12 @@ echo warnUninit in gNotes
# 7555 # 7555
doAssert {-1.int8, -2, -2}.card == 2 doAssert {-1.int8, -2, -2}.card == 2
doAssert {1, 2, 2, 3..5, 4..6}.card == 6 doAssert {1, 2, 2, 3..5, 4..6}.card == 6
type Foo = enum
Foo1 = 0
Foo2 = 1
Foo3 = 3
let x = { Foo1, Foo2 }
# bug #8425