On 2026-07-08 22:40, David Gibson wrote:
On Wed, Jul 08, 2026 at 06:32:02PM -0400, Jon Maloy wrote:
va_start() initialises the va_list, but zero-initialise it at declaration as well to make it clear the variable is not used uninitialised.
I really dislike this approach to suppressing uninitialised variable warnings. A decent tool should be able to tell that va_start() initialises ap, and pre-initialising means that tool will no longer warning if we accidentally deleted the va_start().
Is there really no other way for the warning in question?
TBH I dislike it too. I still decided to post it just to see the feedback. I cannot see any other way to get rid of this warning, but maybe somebody else has? /jon
Signed-off-by: Jon Maloy
--- doc/platform-requirements/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/platform-requirements/common.h b/doc/platform-requirements/common.h index e85fc2b5..815e8271 100644 --- a/doc/platform-requirements/common.h +++ b/doc/platform-requirements/common.h @@ -18,7 +18,7 @@ __attribute__((format(printf, 1, 2), noreturn)) static inline void die(const char *fmt, ...) { - va_list ap; + va_list ap = { 0 };
va_start(ap, fmt); (void)vfprintf(stderr, fmt, ap); -- 2.52.0