From: Nikita Pettik <korablev@tarantool.org> To: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH] sql: fix empty-body warning Date: Tue, 24 Dec 2019 15:42:25 +0300 [thread overview] Message-ID: <ffb06b6ee1cef3e879db72f47eae9e4d5f2bb0ce.1577191289.git.korablev@tarantool.org> (raw) GCC features warning diagnostics which allows to detect wrong ; right after 'if' operator: if (X == Y); { ... } In this case despite evaluation of 'if' argument expression, statements after it will be always executed. According to our codestyle, we neglect bracers around 'if' body in case it consists of single statement and fits into one line. On the other hand, in SQL debug macros like VdbeComment() are defined as empty, so statements like: if (X) VdbeComment(); turn into if (X) ; in release builds. As a result, we get 'false' warning (which is compilation error in -Werror mode). To fix it let's make VdbeComment() macros be non-empty in release mode and expand them into (void) 0. --- Branch: https://github.com/tarantool/tarantool/tree/np/fix-master-build src/box/sql/vdbe.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h index 582d48a1f..d6fa97d90 100644 --- a/src/box/sql/vdbe.h +++ b/src/box/sql/vdbe.h @@ -293,9 +293,9 @@ void sqlVdbeNoopComment(Vdbe *, const char *, ...); #define VdbeModuleComment(X) #endif #else -#define VdbeComment(X) -#define VdbeNoopComment(X) -#define VdbeModuleComment(X) +#define VdbeComment(X) (void) 0 +#define VdbeNoopComment(X) (void) 0 +#define VdbeModuleComment(X) (void) 0 #endif /* -- 2.15.1
next reply other threads:[~2019-12-24 12:42 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-24 12:42 Nikita Pettik [this message] 2019-12-24 15:38 ` Vladislav Shpilevoy 2019-12-24 16:13 ` Nikita Pettik
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=ffb06b6ee1cef3e879db72f47eae9e4d5f2bb0ce.1577191289.git.korablev@tarantool.org \ --to=korablev@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH] sql: fix empty-body warning' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox