output byref types into --header file [backport: 1.6] (#19505)
* output byref types into --header file fix #19445 * fix comments * set targets
This commit is contained in:
parent
b0bd4320a0
commit
2c01c9c4c8
3 changed files with 23 additions and 2 deletions
|
|
@ -471,6 +471,11 @@ proc genProcParams(m: BModule, t: PType, rettype, params: var Rope,
|
|||
var arr = t[0]
|
||||
if params != nil: params.add(", ")
|
||||
if mapReturnType(m.config, t[0]) != ctArray:
|
||||
if isHeaderFile in m.flags:
|
||||
# still generates types for `--header`
|
||||
params.add(getTypeDescAux(m, arr, check, skResult))
|
||||
params.add("*")
|
||||
else:
|
||||
params.add(getTypeDescWeak(m, arr, check, skResult))
|
||||
params.add("*")
|
||||
else:
|
||||
|
|
|
|||
3
tests/ccgbugs/m19445.c
Normal file
3
tests/ccgbugs/m19445.c
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#include "m19445.h"
|
||||
|
||||
const Foo f = {10, 20, 30, 40};
|
||||
13
tests/ccgbugs/t19445.nim
Normal file
13
tests/ccgbugs/t19445.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
discard """
|
||||
matrix: "--nimcache:tests/ccgbugs/nimcache19445 --cincludes:nimcache19445 --header:m19445"
|
||||
targets: "c"
|
||||
"""
|
||||
|
||||
# bug #19445
|
||||
type
|
||||
Foo* {.exportc.} = object
|
||||
a*, b*, c*, d*: int
|
||||
|
||||
proc dummy(): Foo {.exportc.} = discard
|
||||
|
||||
{.compile:"m19445.c".}
|
||||
Loading…
Add table
Add a link
Reference in a new issue