From 7835a25121ea8185b686e01d6b48d2ad3e71f25a Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 1 Aug 2019 11:03:54 +0930 Subject: [PATCH] common: helper to suppress 'may be used uninitialized' warnings. When gcc still warns at -O3 and you are sure it's not necessary, this marks it appropriately. Signed-off-by: Rusty Russell --- common/utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/common/utils.h b/common/utils.h index f7106ca76..7b6ff4f7f 100644 --- a/common/utils.h +++ b/common/utils.h @@ -54,4 +54,9 @@ STRUCTEQ_DEF(sha256, 0, u); /* Define ripemd160_eq. */ STRUCTEQ_DEF(ripemd160, 0, u); +/* If gcc complains about 'may be uninitialized' even at -O3, and the code is + * clear, use this to suppress it. Argument should be gcc version it + * complained on, so we can re-test as gcc evolves. */ +#define COMPILER_WANTS_INIT(compiler_versions) = 0 + #endif /* LIGHTNING_COMMON_UTILS_H */