git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] git-compat-util: always enable variadic macros

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Jan 29, 2021, 02:11 UTC
Message-ID
<YBNu6mqzfhZFpHR/@camp.crustytoothpaste.net>
In-Reply-To
<YBJLgY+CWtS9TeVb@coredump.intra.peff.net>
On 2021-01-28 at 05:28:33, Jeff King wrote:
Show 24 quoted lines
> We allow variadic macros in the code base, but only if there is fallback
> code for platforms that lack it. This leads to some annoyances:
> 
>   - the code is more complicated because of the fallbacks (e.g.,
>     trace_printf(), etc, is implemented twice with a set of parallel
>     wrappers).
> 
>   - some constructs are just impossible and we've had to live without
>     them (e.g., a cross between FLEX_ALLOC and xstrfmt)
> 
> Since this feature is present in C99, we may be able to start counting
> on it being available everywhere. Let's start with a weather balloon
> patch to find out.
> 
> This patch makes the absolute minimal change by always setting
> HAVE_VARIADIC_MACROS. If somebody runs into a platform where it's a
> problem, they can undo it by commenting out the define. Likewise, if we
> have to revert this, it would be quite unlikely to cause conflicts.
> 
> Once we feel comfortable that this is the right direction, then we can
> start ripping out all the spots that actually look at the flag, and
> removing the dead code.
> 
> Signed-off-by: Jeff King <peff@peff.net>

I'm in favor of this change. In fact, as I've previously mentioned, I'm in favor of just requiring C99 support across the board. It has been almost 22 years since that standard came out, after all.

Apparently, even Visual Studio supports C11 and C17 now[0], so there's really no reason not to switch.

[0] https://docs.microsoft.com/en-us/cpp/overview/install-c17-support?view=msvc-160
-- 
brian m. carlson (he/him or they/them)
Houston, Texas, US
Previous: Junio C Hamano
Message 3 of 3 in “git-compat-util: always enable variadic macros”
  1. git-compat-util: always enable variadic macrosJeff King, Jan 28, 2021
  2. Junio C HamanoJan 28, 2021
  3. brian m. carlsonJan 29, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.