mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
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:
@@ -471,8 +471,13 @@ 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:
|
||||
params.add(getTypeDescWeak(m, arr, check, skResult))
|
||||
params.add("*")
|
||||
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:
|
||||
params.add(getTypeDescAux(m, arr, check, skResult))
|
||||
params.addf(" Result", [])
|
||||
|
||||
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".}
|
||||
Reference in New Issue
Block a user