Skip to content

Commit

Permalink
Make listCmd honor hint:cc:off
Browse files Browse the repository at this point in the history
  • Loading branch information
Clyybber committed Mar 8, 2020
1 parent eae31a7 commit 0b7fa34
Showing 1 changed file with 20 additions and 25 deletions.
45 changes: 20 additions & 25 deletions compiler/extccomp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -704,22 +704,6 @@ proc addExternalFileToCompile*(conf: ConfigRef; filename: AbsoluteFile) =
flags: {CfileFlag.External})
addExternalFileToCompile(conf, c)

proc compileCFiles(conf: ConfigRef; list: CfileList, script: var Rope, cmds: var TStringSeq,
prettyCmds: var TStringSeq) =
var currIdx = 0
for it in list:
# call the C compiler for the .c file:
if it.flags.contains(CfileFlag.Cached): continue
var compileCmd = getCompileCFileCmd(conf, it, currIdx == list.len - 1, produceOutput=true)
inc currIdx
if optCompileOnly notin conf.globalOptions:
cmds.add(compileCmd)
let (_, name, _) = splitFile(it.cname)
prettyCmds.add(if conf.hasHint(hintCC): "CC: " & demanglePackageName(name) else: "")
if optGenScript in conf.globalOptions:
script.add(compileCmd)
script.add("\n")

proc getLinkCmd(conf: ConfigRef; output: AbsoluteFile,
objfiles: string, isDllBuild: bool): string =
if optGenStaticLib in conf.globalOptions:
Expand Down Expand Up @@ -857,15 +841,8 @@ proc execCmdsInParallel(conf: ConfigRef; cmds: seq[string]; prettyCb: proc (idx:
cmds[i])
else:
tryExceptOSErrorMessage(conf, "invocation of external compiler program failed."):
if optListCmd in conf.globalOptions or conf.verbosity > 1:
res = execProcesses(cmds, {poEchoCmd, poStdErrToStdOut, poUsePath, poParentStreams},
conf.numberOfProcessors, afterRunEvent=runCb)
elif conf.verbosity == 1:
res = execProcesses(cmds, {poStdErrToStdOut, poUsePath, poParentStreams},
res = execProcesses(cmds, {poStdErrToStdOut, poUsePath, poParentStreams},
conf.numberOfProcessors, prettyCb, afterRunEvent=runCb)
else:
res = execProcesses(cmds, {poStdErrToStdOut, poUsePath, poParentStreams},
conf.numberOfProcessors, afterRunEvent=runCb)
if res != 0:
if conf.numberOfProcessors <= 1:
rawMessage(conf, errGenerated, "execution of an external program failed: '$1'" %
Expand Down Expand Up @@ -921,7 +898,25 @@ proc callCCompiler*(conf: ConfigRef) =
when declared(echo):
let cmd = prettyCmds[idx]
if cmd != "": echo cmd
compileCFiles(conf, conf.toCompile, script, cmds, prettyCmds)

for currIdx, it in conf.toCompile:
# call the C compiler for the .c file:
if CfileFlag.Cached in it.flags: continue
let compileCmd = getCompileCFileCmd(conf, it, currIdx == conf.toCompile.len - 1, produceOutput=true)
if optCompileOnly notin conf.globalOptions:
cmds.add(compileCmd)
prettyCmds.add(if conf.hasHint(hintCC):
if optListCmd in conf.globalOptions or conf.verbosity > 1:
"CC: " & compileCmd
elif conf.verbosity == 1:
"CC: " & demanglePackageName(it.cname.splitFile.name)
else:
""
else: "")
if optGenScript in conf.globalOptions:
script.add(compileCmd)
script.add("\n")

if optCompileOnly notin conf.globalOptions:
execCmdsInParallel(conf, cmds, prettyCb)
if optNoLinking notin conf.globalOptions:
Expand Down

0 comments on commit 0b7fa34

Please sign in to comment.