Consider the following code:
Code: Select all
type mytype
x as integer
end type
sub runthing cdecl (count as integer, ...)
dim test as mytype
dim args as cva_list
cva_start(args, count)
test = cva_arg(args, mytype)
cva_end(args)
end sub
dim thing as mytype
runthing(1, 2)
At least it's getting the size right...D:\Freebasic\FBIDETEMP.c: In function 'RUNTHING':
D:\Freebasic\FBIDETEMP.c:28:96: error: second argument to 'va_arg' is of incomplete type 'void'
28 | __builtin_memcpy( &TEST$1, (struct $6MYTYPE*)&__builtin_va_arg( *(__builtin_va_list*)&ARGS$1, void), 8 );
| ^~~~
If I change the second argument of cva_arg to a builtin type like "integer", we see the following C code emitted and everything is happy:
Code: Select all
TEST$1 = __builtin_va_arg( *(__builtin_va_list*)&ARGS$1, int64);