Subject: Re: [PATCH] strbuf: add compound literal test balloon

From: Junio C Hamano <[email-masked]>
Date: Tue, 15 Jul 2025 09:24:08 -0700

Patrick Steinhardt <[email-masked]> writes:

> We already have a two test balloons, both defined in
> "reftable/system.h":
>
>     #define REFTABLE_FLOCK_INIT ((struct reftable_flock){ .fd = -1, })
>
>     #define REFTABLE_TMPFILE_INIT ((struct reftable_tmpfile) { .fd = -1, })
>
> Both of those are getting used in a way that'd break if those weren't
> properly supported in "reftable/stack.c":
>
> 	for (i = 0; i < last - first + 1; i++)
> 		table_locks[i] = REFTABLE_FLOCK_INIT;
>
> 	tab_file = REFTABLE_TMPFILE_INIT;
>
> Those are rather recent additions though, released with Git 2.50. I also
> totally missed that we didn't have any test balloons for this syntax.
> Should we maybe retroactively mark them as test balloons instead of
> converting and marking some new sites?

That sounds good.  I was wondering if it is easier to keep track of
things to add a new section to the CodingGuildlines document,
perhaps like this?

 Documentation/CodingGuidelines | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git c/Documentation/CodingGuidelines w/Documentation/CodingGuidelines
index 6350949f2e..dd3dbb9c57 100644
--- c/Documentation/CodingGuidelines
+++ w/Documentation/CodingGuidelines
@@ -298,6 +298,14 @@ For C programs:
    . since late 2021 with 44ba10d6, we have had variables declared in
      the for loop "for (int i = 0; i < 10; i++)".
 
+   C99 features we have test balloons for:
+
+   . since late 2024 with v2.48.0-rc0~20, we have test balloons for
+     compound literal syntax, e.g., (struct foo){ .member = value };
+     our hope is that no platforms we care about have trouble using
+     them, and officially adopt its wider use in mid 2026.  Do not add
+     more use of the syntax until that happens.
+
    New C99 features that we cannot use yet:
 
    . %z and %zu as a printf() argument for a size_t (the %z being for