johnwbyrd/logog — pull request #30 by mpapierski (2013-08-11 01:23:18+00:00)
Title: All LOGOG_* macros are single statements now.

Affected macros:

* LOGOG_INITIALIZE.
* LOGOG_SHUTDOWN
* EMERGENCY
* ..
* DBUG

Now you should end all your calls with a semicolon.

Documentation is compatible with this fix. It does mention examples like:

INFO("Hello world!");

Unfortunately this expands to a compound statement, which is a complete
statement with no need for a semicolon to end it.

It looks like a function call and it could lead to a confusion:

if (expr)
INFO("Yes");
else
INFO("No");

The presence of two statements here - compount statement and a null
statement between the if condition and the else makes it invalid code.

This is more complicated if we set LOGOG_LEVEL to LOGOG_LEVEL_NONE. Then
we will have three statements instead of single (compound, null, null)
because in this case INFO(...) expands to {};. After preprocessing we
receive {};;.

This commit makes it all single statements by wrapping them into
do ... while (false) block and the behaviour is now correct in all
use-cases.