mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-16 08:04:20 +00:00
make cgen header consistent with jsgen header (#15682)
This commit is contained in:
@@ -1280,18 +1280,15 @@ proc addNimDefines(result: var Rope; conf: ConfigRef) {.inline.} =
|
||||
if conf.isDefined("nimEmulateOverflowChecks"):
|
||||
result.add("#define NIM_EmulateOverflowChecks\L")
|
||||
|
||||
proc headerTop(): Rope =
|
||||
result = "/* Generated by Nim Compiler v$1 */$N" % [rope(VersionAsString)]
|
||||
|
||||
proc getCopyright(conf: ConfigRef; cfile: Cfile): Rope =
|
||||
if optCompileOnly in conf.globalOptions:
|
||||
result = ("/* Generated by Nim Compiler v$1 */$N" &
|
||||
"/* The generated code is subject to the original license. */$N") %
|
||||
[rope(VersionAsString)]
|
||||
else:
|
||||
result = ("/* Generated by Nim Compiler v$1 */$N" &
|
||||
"/* The generated code is subject to the original license. */$N" &
|
||||
"/* Compiled for: $2, $3, $4 */$N" &
|
||||
"/* Command for C compiler:$n $5 */$N") %
|
||||
[rope(VersionAsString),
|
||||
rope(platform.OS[conf.target.targetOS].name),
|
||||
result = headerTop()
|
||||
if optCompileOnly notin conf.globalOptions:
|
||||
result.add ("/* Compiled for: $1, $2, $3 */$N" &
|
||||
"/* Command for C compiler:$n $4 */$N") %
|
||||
[rope(platform.OS[conf.target.targetOS].name),
|
||||
rope(platform.CPU[conf.target.targetCPU].name),
|
||||
rope(extccomp.CC[conf.cCompiler].name),
|
||||
rope(getCompileCFileCmd(conf, cfile))]
|
||||
@@ -1858,11 +1855,7 @@ proc myOpen(graph: ModuleGraph; module: PSym): PPassContext {.nosinks.} =
|
||||
incl g.generatedHeader.flags, isHeaderFile
|
||||
|
||||
proc writeHeader(m: BModule) =
|
||||
# could factor with 2 other instances
|
||||
var result = ("/* Generated by Nim Compiler v$1 */$N" &
|
||||
"/* The generated code is subject to the original license. */$N") %
|
||||
[rope(VersionAsString)]
|
||||
|
||||
var result = headerTop()
|
||||
var guard = "__$1__" % [m.filename.splitFile.name.rope]
|
||||
result.addf("#ifndef $1$n#define $1$n", [guard])
|
||||
addNimDefines(result, m.config)
|
||||
|
||||
Reference in New Issue
Block a user