Re: [PATCH] list-objects-filter-options: fix function name in BUG
- From
Jonathan Nieder <jrnieder@gmail.com>
- Date
- Nov 18, 2020, 02:24 UTC
- Message-ID
- <20201118022402.GC360414@google.com>
- In-Reply-To
- <20201117225401.GA642410@coredump.intra.peff.net>
Jeff King wrote:
Show 14 quoted lines
> I actually wonder if it is time to drop HAVE_VARIADIC_MACROS completely. > They are in C99, and we have been introducing many other C99-isms. It > would be a minor cleanup to a few bits of code, which perhaps isn't > worth the risk. But I also have a vague memory of not being able to > implement some interfaces because we couldn't count on them. > > Poking around, 3689539127 (add helpers for allocating flex-array > structs, 2016-02-22) points out one such case. I think discussion of > BUG_ON() got blocked by that, too. Looks like we also discussed them in > the big "C99 weather balloon" thread: > > https://lore.kernel.org/git/20170710070342.txmlwwq6gvjkwtw7@sigill.intra.peff.net/ > > Maybe it's time for something like this as a test:
Yes. For what it's worth, Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Want to re-send with a signoff?
Thanks, Jonathan
Show 47 quoted lines
> diff --git a/git-compat-util.h b/git-compat-util.h
> index 2fd9d5b403..fe5de2239f 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -1194,14 +1194,9 @@ static inline int regexec_buf(const regex_t *preg, const char *buf, size_t size,
> /* usage.c: only to be used for testing BUG() implementation (see test-tool) */
> extern int BUG_exit_code;
>
> -#ifdef HAVE_VARIADIC_MACROS
> __attribute__((format (printf, 3, 4))) NORETURN
> void BUG_fl(const char *file, int line, const char *fmt, ...);
> #define BUG(...) BUG_fl(__FILE__, __LINE__, __VA_ARGS__)
> -#else
> -__attribute__((format (printf, 1, 2))) NORETURN
> -void BUG(const char *fmt, ...);
> -#endif
>
> /*
> * Preserves errno, prints a message, but gives no warning for ENOENT.
> diff --git a/usage.c b/usage.c
> index 06665823a2..b72f48f70e 100644
> --- a/usage.c
> +++ b/usage.c
> @@ -273,23 +273,13 @@ static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_lis
> abort();
> }
>
> -#ifdef HAVE_VARIADIC_MACROS
> NORETURN void BUG_fl(const char *file, int line, const char *fmt, ...)
> {
> va_list ap;
> va_start(ap, fmt);
> BUG_vfl(file, line, fmt, ap);
> va_end(ap);
> }
> -#else
> -NORETURN void BUG(const char *fmt, ...)
> -{
> - va_list ap;
> - va_start(ap, fmt);
> - BUG_vfl(NULL, 0, fmt, ap);
> - va_end(ap);
> -}
> -#endif
>
> #ifdef SUPPRESS_ANNOTATED_LEAKS
> void unleak_memory(const void *ptr, size_t len)