From 4850f9b5969d52980177400a75af890f72d579d0 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Mon, 14 Dec 2020 02:17:24 -0800 Subject: [PATCH] fix #16265; fix #13999 (HCR on OSX); cgen now does not line wrap string litterals (#16329) * fix #16265: cgen now does not line wrap string litterals which, in combination with other hacks, caused a really obscure looking bug * fix #13999; nimhcr_integration.nim now works for osx * try to make appveyor CI disappear * disable openbsd + add diagnostic for openbsd * enable for openbsd * PTEMP * re-disable openbsd --- compiler/cgen.nim | 3 +++ compiler/msgs.nim | 8 +++++--- tests/dll/nimhcr_integration.nim | 17 +++++++++++++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/compiler/cgen.nim b/compiler/cgen.nim index c4544bbc56..220b8e3c12 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -1556,6 +1556,9 @@ proc registerModuleToMain(g: BModuleList; m: BModule) = # nasty nasty hack to get the command line functionality working with HCR # register the 2 variables on behalf of the os module which might not even # be loaded (in which case it will get collected but that is not a problem) + # EDIT: indeed, this hack, in combination with another un-necessary one + # (`makeCString` was doing line wrap of string litterals) was root cause for + # bug #16265. let osModulePath = ($systemModulePath).replace("stdlib_system", "stdlib_os").rope g.mainDatInit.addf("\thcrAddModule($1);\n", [osModulePath]) g.mainDatInit.add("\tint* cmd_count;\n") diff --git a/compiler/msgs.nim b/compiler/msgs.nim index d0209db5d0..1a005788e1 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -34,13 +34,15 @@ proc toCChar*(c: char; result: var string) = result.add c proc makeCString*(s: string): Rope = - const MaxLineLength = 64 result = nil var res = newStringOfCap(int(s.len.toFloat * 1.1) + 1) res.add("\"") for i in 0.. 0 let (stdout, exitcode) = execCmdEx(cmd) if exitcode != 0: echo "COMPILATION ERROR!"