"Empty statement" warnings for disabled macros
I have the usual sort of DEBUG macros:
#ifdef SERIAL_DEBUG
#define serial_debug(...) Serial.debug(__VA_ARGS__)
#else
#define serial_debug(...)
#endif
In the code, if SERIAL_DEBUG is not defined, then this line is identified with the warning "Empty statement":
serial_debug("Hello world!");
I think this is because there is essentially a semicolon without a preceding statement.
How can the warning be removed without disabling the inspection?
I could add a semicolon to the macro definition and remove it from each use of the macro, but seeing statements in the code without semicolons looks wrong.
Thanks!
Please sign in to leave a comment.
You can define a c++ NOP statement like this
for the non-debug case. The compiler sees a statement, thus doesn't complain, and compiles it to nothing.