Skip to content

Commit

Permalink
Don't print blank lines when comments are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
simonlindholm committed May 18, 2024
1 parent 1c7b040 commit 1cb6b55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions m2c/if_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -1414,9 +1414,9 @@ def get_function_text(function_info: FunctionInfo, options: Options) -> str:
function_lines: List[str] = []

if function_info.symbol.demangled_str is not None:
function_lines.append(
fmt.with_comments("", [function_info.symbol.demangled_str])
)
line = fmt.with_comments("", [function_info.symbol.demangled_str])
if line:
function_lines.append(line)

fn_name = function_info.stack_info.function.name
arg_strs = []
Expand Down
4 changes: 3 additions & 1 deletion m2c/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ def run(options: Options) -> int:
return_code = 1

for warning in typepool.warnings:
print(fmt.with_comments("", comments=[warning]))
line = fmt.with_comments("", comments=[warning])
if line:
print(line)

return return_code

Expand Down

0 comments on commit 1cb6b55

Please sign in to comment.