From: Jeff King <peff@peff•net>
To: Patrick Steinhardt <ps@pks•im>
Cc: Karthik Nayak <karthik.188@gmail•com>,
git@vger•kernel.org, Phillip Wood <phillip.wood123@gmail•com>
Subject: Re: [PATCH v2 1/3] t/unit-tests: update clar to 39f11fe
Date: Wed, 7 Jan 2026 02:40:00 -0500 [thread overview]
Message-ID: <20260107074000.GA102520@coredump.intra.peff.net> (raw)
In-Reply-To: <aVzvDGVEI2qVJv2F@pks.im>
On Tue, Jan 06, 2026 at 12:16:28PM +0100, Patrick Steinhardt wrote:
> 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
next prev parent reply other threads:[~2026-01-07 7:40 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-05 12:57 [PATCH 0/2] Update clar for improved integer handling Patrick Steinhardt
2025-12-05 12:57 ` [PATCH 1/2] t/unit-tests: update clar to 39f11fe Patrick Steinhardt
2025-12-05 18:40 ` Jeff King
2025-12-06 11:39 ` Patrick Steinhardt
2025-12-06 5:27 ` Junio C Hamano
2025-12-06 11:46 ` Patrick Steinhardt
2025-12-05 12:57 ` [PATCH 2/2] t/unit-tests: demonstrate use of integer comparison assertions Patrick Steinhardt
2025-12-06 11:47 ` [PATCH v2 0/3] Update clar for improved integer handling Patrick Steinhardt
2025-12-06 11:47 ` [PATCH v2 1/3] t/unit-tests: update clar to 39f11fe Patrick Steinhardt
2026-01-06 10:59 ` Karthik Nayak
2026-01-06 11:16 ` Patrick Steinhardt
2026-01-06 16:28 ` Karthik Nayak
2026-01-07 7:40 ` Jeff King [this message]
2026-01-08 12:46 ` Junio C Hamano
2025-12-06 11:47 ` [PATCH v2 2/3] t/unit-tests: demonstrate use of integer comparison assertions Patrick Steinhardt
2025-12-06 11:47 ` [PATCH v2 3/3] gitattributes: disable blank-at-eof errors for clar test expectations Patrick Steinhardt
2026-01-06 11:01 ` [PATCH v2 0/3] Update clar for improved integer handling Karthik Nayak
2026-01-06 11:16 ` Patrick Steinhardt
2026-01-07 3:53 ` Junio C Hamano
2026-01-07 7:01 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260107074000.GA102520@coredump.intra.peff.net \
--to=peff@peff$(echo .)net \
--cc=git@vger$(echo .)kernel.org \
--cc=karthik.188@gmail$(echo .)com \
--cc=phillip.wood123@gmail$(echo .)com \
--cc=ps@pks$(echo .)im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox