mangle names in nimbase.h using cppDefine (#19395) [backport]

mangle names in nimbase.h
fix comments
This commit is contained in:
flywind
2022-01-17 18:14:13 +08:00
committed by GitHub
parent 2c5b367001
commit 4f6b59de96
2 changed files with 21 additions and 0 deletions

View File

@@ -3,6 +3,11 @@
cppDefine "errno"
cppDefine "unix"
# mangle the macro names in nimbase.h
cppDefine "NAN_INFINITY"
cppDefine "INF"
cppDefine "NAN"
when defined(nimStrictMode):
# xxx add more flags here, and use `-d:nimStrictMode` in more contexts in CI.

16
tests/ccgbugs/tmangle.nim Normal file
View File

@@ -0,0 +1,16 @@
block:
proc hello() =
let NAN_INFINITY = 12
doAssert NAN_INFINITY == 12
let INF = "2.0"
doAssert INF == "2.0"
let NAN = 2.3
doAssert NAN == 2.3
hello()
block:
proc hello(NAN: float) =
doAssert NAN == 2.0
hello(2.0)