-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More correct empty-block detection logic
The old logic was very ad-hoc and was located with break/continue/return statements since those are the statements that are typically omitted. When writing it, I didn't take into account is that compound statements can be empty, in which case a ':' also needs to be emitted. The new logic moves the responsability of emitting the ':' to the code creating the if/loop/function which simplifies the code and fixes the issue with compound statements.
- Loading branch information
1 parent
60406b5
commit 8534227
Showing
3 changed files
with
49 additions
and
29 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <stdio.h> | ||
|
||
void main() { | ||
if (1) { | ||
// Empty if | ||
} | ||
|
||
if (1) { | ||
{ | ||
// Empty compound statement | ||
} | ||
} | ||
} |
Empty file.