From 58ac7f0b4b17e314193776268e39072949a8448d Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Mon, 24 Apr 2023 21:46:45 +0300 Subject: [PATCH 17/17] Rearrange sg_failure_ret[_val]() To make it clear to compiler/analyzer that sg_success is FALSE after this, and not potentially restored to TRUE by the logging call. See osdn #45822 Signed-off-by: Marko Lindqvist --- server/savecompat.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/server/savecompat.h b/server/savecompat.h index f36d247586..8f20747ce5 100644 --- a/server/savecompat.h +++ b/server/savecompat.h @@ -130,6 +130,7 @@ struct loaddata { if (!sg_success) { \ return; \ } + #define sg_check_ret_val(_val) \ if (!sg_success) { \ return _val; \ @@ -139,11 +140,13 @@ struct loaddata { if (!(condition)) { \ log_sg(message, ## __VA_ARGS__); \ } + #define sg_warn_ret(condition, message, ...) \ if (!(condition)) { \ log_sg(message, ## __VA_ARGS__); \ return; \ } + #define sg_warn_ret_val(condition, _val, message, ...) \ if (!(condition)) { \ log_sg(message, ## __VA_ARGS__); \ @@ -152,14 +155,15 @@ struct loaddata { #define sg_failure_ret(condition, message, ...) \ if (!(condition)) { \ - sg_success = FALSE; \ log_sg(message, ## __VA_ARGS__); \ + sg_success = FALSE; \ sg_check_ret(); \ } + #define sg_failure_ret_val(condition, _val, message, ...) \ if (!(condition)) { \ - sg_success = FALSE; \ log_sg(message, ## __VA_ARGS__); \ + sg_success = FALSE; \ sg_check_ret_val(_val); \ } -- 2.39.2