From 21d0cc8cdf432b0eaf0bd6ea16d00070ab9dab89 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 15 Apr 2014 13:51:25 +0100 Subject: Add checks for invalid socket when creating sockets. --- compiler/service.nim | 1 + 1 file changed, 1 insertion(+) (limited to 'compiler') diff --git a/compiler/service.nim b/compiler/service.nim index 42c4aa9f4..2b861e1c7 100644 --- a/compiler/service.nim +++ b/compiler/service.nim @@ -84,6 +84,7 @@ proc serve*(action: proc (){.nimcall.}) = of "tcp", "": when useCaas: var server = socket() + if server == invalidSocket: osError(osLastError()) let p = getConfigVar("server.port") let port = if p.len > 0: parseInt(p).TPort else: 6000.TPort server.bindAddr(port, getConfigVar("server.address")) -- cgit 1.4.1-2-gfad0 From 9e7c0fd2b03285636ad4faf35dadb1f289aeeeff Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Tue, 15 Apr 2014 13:53:02 +0100 Subject: Fixes #1005 --- compiler/ccgexprs.nim | 3 +++ tests/assign/tobjasgn.nim | 15 ++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) (limited to 'compiler') diff --git a/compiler/ccgexprs.nim b/compiler/ccgexprs.nim index e346e1b53..7c4cc2b80 100644 --- a/compiler/ccgexprs.nim +++ b/compiler/ccgexprs.nim @@ -1060,6 +1060,8 @@ proc genObjConstr(p: BProc, e: PNode, d: var TLoc) = t = t.sons[0].skipTypes(abstractInst) r = ropef("(*$1)", r) gcUsage(e) + else: + constructLoc(p, tmp) discard getTypeDesc(p.module, t) for i in 1 .. Date: Wed, 16 Apr 2014 22:10:02 +0200 Subject: Adds option to exclude nimcache dirs from time machine backups. --- compiler/options.nim | 27 ++++++++++++++++++++++++++- koch.nim | 1 + 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/options.nim b/compiler/options.nim index fa8b77ead..f05354666 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -8,7 +8,7 @@ # import - os, lists, strutils, strtabs + os, lists, strutils, strtabs, osproc, sets const hasTinyCBackend* = defined(tinyc) @@ -16,6 +16,7 @@ const hasFFI* = defined(useFFI) newScopeForIf* = true useCaas* = not defined(noCaas) + noTimeMachine = defined(avoidTimeMachine) and defined(macosx) type # please make sure we have under 32 options # (improves code efficiency a lot!) @@ -263,6 +264,28 @@ proc toGeneratedFile*(path, ext: string): string = result = joinPath([getGeneratedPath(), changeFileExt(tail, ext)]) #echo "toGeneratedFile(", path, ", ", ext, ") = ", result +when noTimeMachine: + var alreadyExcludedDirs = initSet[string]() + proc excludeDirFromTimeMachine(dir: string) {.raises: [].} = + ## Calls a macosx command on the directory to exclude it from backups. + ## + ## The macosx tmutil command is invoked to mark the specified path as an + ## item to be excluded from time machine backups. If a path already exists + ## with files before excluding it, newer files won't be added to the + ## directory, but previous files won't be removed from the backup until the + ## user deletes that directory. + ## + ## The whole proc is optional and will ignore all kinds of errors. The only + ## way to be sure that it works is to call ``tmutil isexcluded path``. + if alreadyExcludedDirs.contains(dir): return + alreadyExcludedDirs.incl(dir) + try: + var p = startProcess("/usr/bin/tmutil", args = ["addexclusion", dir]) + discard p.waitForExit + p.close + except E_Base, EOS: + discard + proc completeGeneratedFilePath*(f: string, createSubDir: bool = true): string = var (head, tail) = splitPath(f) #if len(head) > 0: head = removeTrailingDirSep(shortenDir(head & dirSep)) @@ -270,6 +293,8 @@ proc completeGeneratedFilePath*(f: string, createSubDir: bool = true): string = if createSubDir: try: createDir(subdir) + when noTimeMachine: + excludeDirFromTimeMachine(subdir) except EOS: writeln(stdout, "cannot create directory: " & subdir) quit(1) diff --git a/koch.nim b/koch.nim index d7da56590..9d59344f2 100644 --- a/koch.nim +++ b/koch.nim @@ -53,6 +53,7 @@ Boot options: (not needed on Windows) -d:nativeStacktrace use native stack traces (only for Mac OS X or Linux) -d:noCaas build Nimrod without CAAS support + -d:avoidTimeMachine only for Mac OS X, excludes nimcache dir from backups """ proc exe(f: string): string = return addFileExt(f, ExeExt) -- cgit 1.4.1-2-gfad0 From 23e9ed81a274bd4c6420d9c900e7275f59125f95 Mon Sep 17 00:00:00 2001 From: Simon Hafner Date: Fri, 18 Apr 2014 21:19:07 -0500 Subject: added `continue` to errStmtInvalidAfterReturn --- compiler/msgs.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler') diff --git a/compiler/msgs.nim b/compiler/msgs.nim index a63fbca7f..b1d03e503 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -170,7 +170,7 @@ const errInvalidNumberOfYieldExpr: "invalid number of \'yield\' expressions", errCannotReturnExpr: "current routine cannot return an expression", errAttemptToRedefine: "redefinition of \'$1\'", - errStmtInvalidAfterReturn: "statement not allowed after \'return\', \'break\' or \'raise\'", + errStmtInvalidAfterReturn: "statement not allowed after \'return\', \'break\', \'raise\' or \'continue'", errStmtExpected: "statement expected", errInvalidLabel: "\'$1\' is no label", errInvalidCmdLineOption: "invalid command line option: \'$1\'", -- cgit 1.4.1-2-gfad0