only register initial varg struct on first pass (#2404)

pull/2409/head
joe-conigliaro 2019-10-18 19:28:14 +11:00 committed by GitHub
parent 368e8e85a8
commit 689003454b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -737,8 +737,10 @@ fn (p mut Parser) fn_args(f mut Fn) {
}
t := p.get_type()
// register varg struct, incase function is never called
vargs_struct := p.fn_register_vargs_stuct(f, t, []string)
p.cgen.typedefs << 'typedef struct $vargs_struct $vargs_struct;\n'
if p.first_pass() {
vargs_struct := p.fn_register_vargs_stuct(f, t, []string)
p.cgen.typedefs << 'typedef struct $vargs_struct $vargs_struct;\n'
}
typ = '...$t'
} else {
typ = p.get_type()