Re: [PATCH v2 1/3] t/unit-tests: update clar to 39f11fe
- From
Jeff King <peff@peff.net>
- Date
- Jan 7, 2026, 07:40 UTC
- Message-ID
- <20260107074000.GA102520@coredump.intra.peff.net>
- In-Reply-To
- <aVzvDGVEI2qVJv2F@pks.im>
On Tue, Jan 06, 2026 at 12:16:28PM +0100, Patrick Steinhardt wrote:
Show 14 quoted lines
> The problem is that we cannot do so easily. Varargs require at least one
> argument to be present, so we cannot make this `cl_fail(desc, ...)`
> without breaking the case where there are no variable arguments:
>
> In file included from ../t/unit-tests/clar/clar.c:1053:
> ../t/unit-tests/clar/clar/fs.h:460:3: error: expected expression
> 460 | cl_fail("Cannot copy; cannot stat destination");
> | ^
> ../t/unit-tests/clar/clar.h:152:132: note: expanded from macro 'cl_fail'
> 152 | #define cl_fail(desc,...) clar__failf(CLAR_CURRENT_FILE, CLAR_CURRENT_FUNC, CLAR_CURRENT_LINE, 1, "Test failed.", desc, __VA_ARGS__)
> | ^
>
> The alternative would be to make this `cl_fail(...)` instead, but to the
> best of my knowledge this isn't even a valid construct.It is valid; that's how we define BUG(), for example.
There are other options like GNU's "## __VA_ARGS__", but I think eating the format argument with the "..." is the only portable way, at least for standard versions we'd support. I think C23 added __VA_OPT__.
-Peff