* fixes #21116; always mangles the param * idOrSig * fixes tests * Apply suggestions from code review
This commit is contained in:
parent
7fa983f5e6
commit
d83f66a24d
3 changed files with 12 additions and 6 deletions
|
|
@ -48,11 +48,9 @@ proc fillBackendName(m: BModule; s: PSym) =
|
||||||
writeMangledName(m.ndi, s, m.config)
|
writeMangledName(m.ndi, s, m.config)
|
||||||
|
|
||||||
proc fillParamName(m: BModule; s: PSym) =
|
proc fillParamName(m: BModule; s: PSym) =
|
||||||
## we cannot use 'sigConflicts' here since we have a BModule, not a BProc.
|
|
||||||
## Fortunately C's scoping rules are sane enough so that that doesn't
|
|
||||||
## cause any trouble.
|
|
||||||
if s.loc.r == "":
|
if s.loc.r == "":
|
||||||
var res = s.name.s.mangle
|
var res = s.name.s.mangle
|
||||||
|
res.add idOrSig(s, res, m.sigConflicts)
|
||||||
# Take into account if HCR is on because of the following scenario:
|
# Take into account if HCR is on because of the following scenario:
|
||||||
# if a module gets imported and it has some more importc symbols in it,
|
# if a module gets imported and it has some more importc symbols in it,
|
||||||
# some param names might receive the "_0" suffix to distinguish from what
|
# some param names might receive the "_0" suffix to distinguish from what
|
||||||
|
|
@ -69,8 +67,6 @@ proc fillParamName(m: BModule; s: PSym) =
|
||||||
# and a function called in main or proxy uses `socket` as a parameter name.
|
# and a function called in main or proxy uses `socket` as a parameter name.
|
||||||
# That would lead to either needing to reload `proxy` or to overwrite the
|
# That would lead to either needing to reload `proxy` or to overwrite the
|
||||||
# executable file for the main module, which is running (or both!) -> error.
|
# executable file for the main module, which is running (or both!) -> error.
|
||||||
if m.hcrOn or isKeyword(s.name) or m.g.config.cppDefines.contains(res):
|
|
||||||
res.add "_0"
|
|
||||||
s.loc.r = res.rope
|
s.loc.r = res.rope
|
||||||
writeMangledName(m.ndi, s, m.config)
|
writeMangledName(m.ndi, s, m.config)
|
||||||
|
|
||||||
|
|
|
||||||
10
tests/ccgbugs/t21116.nim
Normal file
10
tests/ccgbugs/t21116.nim
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
discard """
|
||||||
|
target: "c cpp"
|
||||||
|
disabled: windows
|
||||||
|
"""
|
||||||
|
# bug #21116
|
||||||
|
import std/os
|
||||||
|
|
||||||
|
proc p(glob: string) =
|
||||||
|
for _ in walkFiles(glob): discard
|
||||||
|
p("dir/*")
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
ccodecheck: "\\i@'NI* NIM_NOALIAS field;' @'NIM_CHAR* NIM_NOALIAS x,' @'void* NIM_NOALIAS q'"
|
ccodecheck: "\\i@'NI* NIM_NOALIAS field;' @'NIM_CHAR* NIM_NOALIAS x__0qEngDE9aYoYsF8tWnyPacw,' @'void* NIM_NOALIAS q'"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue