Skip to content

Commit

Permalink
fix nim-lang#11590: c compiler warnings silently ignored, giving unde…
Browse files Browse the repository at this point in the history
…fined behavior
  • Loading branch information
timotheecour committed Nov 26, 2019
1 parent bc75f7f commit 3ec2a9a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 6 additions & 5 deletions compiler/extccomp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -844,8 +844,7 @@ proc execCmdsInParallel(conf: ConfigRef; cmds: seq[string]; prettyCb: proc (idx:
let exitCode = p.peekExitCode
if exitCode != 0:
rawMessage(conf, errGenerated, "execution of an external compiler program '" &
cmds[idx] & "' failed with exit code: " & $exitCode & "\n\n" &
p.outputStream.readAll.strip)
cmds[idx] & "' failed with exit code: " & $exitCode & "\n\n")
if conf.numberOfProcessors == 0: conf.numberOfProcessors = countProcessors()
var res = 0
if conf.numberOfProcessors <= 1:
Expand All @@ -857,14 +856,16 @@ proc execCmdsInParallel(conf: ConfigRef; cmds: seq[string]; prettyCb: proc (idx:
cmds[i])
else:
tryExceptOSErrorMessage(conf, "invocation of external compiler program failed."):
# keep writing errors/warnings to stderr
let defaultOpt = {poParentStreams, poUsePath}
if optListCmd in conf.globalOptions or conf.verbosity > 1:
res = execProcesses(cmds, {poEchoCmd, poStdErrToStdOut, poUsePath},
res = execProcesses(cmds, {poEchoCmd} + defaultOpt,
conf.numberOfProcessors, afterRunEvent=runCb)
elif conf.verbosity == 1:
res = execProcesses(cmds, {poStdErrToStdOut, poUsePath},
res = execProcesses(cmds, defaultOpt,
conf.numberOfProcessors, prettyCb, afterRunEvent=runCb)
else:
res = execProcesses(cmds, {poStdErrToStdOut, poUsePath},
res = execProcesses(cmds, defaultOpt,
conf.numberOfProcessors, afterRunEvent=runCb)
if res != 0:
if conf.numberOfProcessors <= 1:
Expand Down
4 changes: 3 additions & 1 deletion config/nim.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ llvm_gcc.options.size = "-Os"
# Configuration for the LLVM CLang compiler:
clang.options.debug = "-g"
clang.cpp.options.debug = "-g"
clang.options.always = "-w"
# pending fixing `sem.nim.c:16829:37: error: & has lower precedence than ==`
# when compiling nim, we can remove `-Wno-error=parentheses`
clang.options.always = "-Werror -Wno-error=parentheses"
clang.options.speed = "-O3"
clang.options.size = "-Os"

Expand Down

0 comments on commit 3ec2a9a

Please sign in to comment.