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

mangle names in nimbase.h
fix comments

(cherry picked from commit 4f6b59de96)
This commit is contained in:
flywind
2022-01-17 18:14:13 +08:00
committed by narimiran
parent 01c8262426
commit 1d92e79dac
2 changed files with 22 additions and 0 deletions

View File

@@ -3,3 +3,9 @@
when defined(nimHasCppDefine):
cppDefine "errno"
cppDefine "unix"
# mangle the macro names in nimbase.h
cppDefine "NAN_INFINITY"
cppDefine "INF"
cppDefine "NAN"

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)