Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions util/strip.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,14 @@ def scan(file: str) -> list[str]:
delete_empty_line = True
continue

# Strip '#ifdef __UNIT_TEST__' blocks (keep #else clauses)
# Strip '#ifdef __UNIT_TEST__' blocks and the '#else' clauses of
# '#ifndef __UNIT_TEST__' blocks.
if in_unit:
if line.startswith('#endif /* __UNIT_TEST__ */'):
in_unit = None
continue
if line.startswith('#else /* __UNIT_TEST__ */'):
in_unit = 'else'
in_unit = 'if' if in_unit == 'else' else 'else'
continue
if in_unit == 'if':
continue
Expand Down