From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 02D1046970E for ; Tue, 24 Dec 2019 15:42:29 +0300 (MSK) From: Nikita Pettik Date: Tue, 24 Dec 2019 15:42:25 +0300 Message-Id: Subject: [Tarantool-patches] [PATCH] sql: fix empty-body warning List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org 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