[Issue 22960] importC: K&R-style functions assume variadic calling convention

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 30 09:14:31 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22960

--- Comment #3 from Iain Buclaw <ibuclaw at gdcproject.org> ---
DMD's undoing here is that it set's up a va_list in the prologue, but k&r
functions are pseudo-variadic, so it can get away without having va_list.

In fact, it's an error to construct a va_list object in a k&r function in gcc:
---
void other(x)
        int x;
{
  __builtin_va_list argp;
  __builtin_va_start(argp, x);
}
// file2.c: In function ‘other’:
// file2.c:5:3: error: ‘va_start’ used in function with fixed arguments
---

--


More information about the Digitalmars-d-bugs mailing list