diff options
author | Stefan Talpalaru <stefantalpalaru@yahoo.com> | 2015-06-15 08:44:02 +0200 |
---|---|---|
committer | Stefan Talpalaru <stefantalpalaru@yahoo.com> | 2015-06-15 08:44:02 +0200 |
commit | bdac85f2cfbff9bab11f06c72f364523936a5487 (patch) | |
tree | 41313479b483459e312280cf42b6f862acba4bd3 /compiler/extccomp.nim | |
parent | 657d6f9de2d8fc8960fb703f927db2ff2070d5a4 (diff) | |
parent | 8c671d22d6a7c55e13e7c02eb4fd65bbabb52131 (diff) | |
download | Nim-bdac85f2cfbff9bab11f06c72f364523936a5487.tar.gz |
Merge branch 'devel' into gogc
Diffstat (limited to 'compiler/extccomp.nim')
-rw-r--r-- | compiler/extccomp.nim | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim index 186a3884d..38427b367 100644 --- a/compiler/extccomp.nim +++ b/compiler/extccomp.nim @@ -13,7 +13,8 @@ # nim files. import - lists, ropes, os, strutils, osproc, platform, condsyms, options, msgs, crc + lists, ropes, os, strutils, osproc, platform, condsyms, options, msgs, + securehash type TSystemCC* = enum @@ -572,26 +573,24 @@ proc getCompileCFileCmd*(cfilename: string, isExternal = false): string = "nim", quoteShell(getPrefixDir()), "lib", quoteShell(libpath)]) -proc footprint(filename: string): TCrc32 = - # note, '><' further modifies a crc value with a string. - result = crcFromFile(filename) >< - platform.OS[targetOS].name >< - platform.CPU[targetCPU].name >< - extccomp.CC[extccomp.cCompiler].name >< - getCompileCFileCmd(filename, true) +proc footprint(filename: string): SecureHash = + result = secureHash( + $secureHashFile(filename) & + platform.OS[targetOS].name & + platform.CPU[targetCPU].name & + extccomp.CC[extccomp.cCompiler].name & + getCompileCFileCmd(filename, true)) proc externalFileChanged(filename: string): bool = if gCmd notin {cmdCompileToC, cmdCompileToCpp, cmdCompileToOC, cmdCompileToLLVM}: return false var crcFile = toGeneratedFile(filename.withPackageName, "crc") - var currentCrc = int(footprint(filename)) + var currentCrc = footprint(filename) var f: File if open(f, crcFile, fmRead): - var line = newStringOfCap(40) - if not f.readLine(line): line = "0" + let oldCrc = parseSecureHash(f.readLine()) close(f) - var oldCrc = parseInt(line) result = oldCrc != currentCrc else: result = true |