Skip to content
Snippets Groups Projects
Commit 1d95fc04 authored by Nikita Pettik's avatar Nikita Pettik
Browse files

sql: fix empty-body warning

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.
parent d2ea6e41
No related branches found
No related tags found
No related merge requests found
......@@ -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
/*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment