-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure LOG* and CHECK* macros are statement-safe (#320)
The LOG and LOGF macros had been modified to be statement-safe, but the LOG_IF, CHECK, LOGF_IF, CHECKF, and CHECK_F macros were all still unsafe in face of code where single-statement blocks were not enclosed in {}. For example code like this: if (!foobar) CHECKF(goodness, "badness detected!"); else handle_foobar(foobar); would fail in subtle and possibly dangerous ways. Fix this by combining multiple if-statements into a single conditional and inverting the conditions, then adding an empty then-block and moving the log statement to the else-block.
- Loading branch information
1 parent
5cb5371
commit f149179
Showing
1 changed file
with
8 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters