bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error: Support the compiler's control flow analysis better (was: cop


From: Bruno Haible
Subject: Re: error: Support the compiler's control flow analysis better (was: copy-file: Silence gcc warnings)
Date: Wed, 31 May 2023 00:06:20 +0200

Paul Eggert wrote:
> > +#  define error(status, ...) \
> > +     ((error)(0, __VA_ARGS__), (status) ? exit (status) : (void)0)
> 
> We can do a bit better than that by using 'unreachable ()' instead of 
> 'exit (status)', and passing 'status' (instead of 0) to the underlying 
> error function. This saves a function call

In terms of functions calls, I don't think it makes a difference,
whether exit() gets called from within the error() invocation [1] or
after the error() invocation. 

[1] lib/error.c:285

> Also, it's better to not evaluate 'status' twice. Not that I think 
> 'status' should have side effects or even that it does have side effects 
> in any Gnulib-using code, just that it's more hygienic in case some 
> caller foolishly puts side effects there.

Indeed, having it evaluate only once is better. Thanks.

> +     __gl_error_call (rpl_error, status, __VA_ARGS)

What is __VA_ARGS ? Did you mean __VA_ARGS__ ?

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]