Skip to content

Commit ea44647

Browse files
committed
[clang-format] Write in text mode with LF in dump_format_[help|style].py
1 parent 37d0e2f commit ea44647

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

clang/docs/tools/dump_format_help.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,7 @@ def validate(text, columns):
7272

7373
contents = substitute(contents, "FORMAT_HELP", help_text)
7474

75-
with open(opts.output if opts.output else DOC_FILE, "wb") as output:
76-
output.write(contents.encode())
75+
with open(
76+
opts.output if opts.output else DOC_FILE, "w", newline="", encoding="utf-8"
77+
) as f:
78+
f.write(contents)

clang/docs/tools/dump_format_style.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ class State:
411411
state = State.InStruct
412412
enums[enum.name] = enum
413413
else:
414-
# Enum member without documentation. Must be documented where the enum
415-
# is used.
414+
# Enum member without documentation. Must be documented
415+
# where the enum is used.
416416
pass
417417
elif state == State.InNestedEnum:
418418
if line.startswith("///"):
@@ -492,5 +492,7 @@ class State:
492492

493493
contents = substitute(contents, "FORMAT_STYLE_OPTIONS", options_text)
494494

495-
with open(args.output if args.output else DOC_FILE, "wb") as output:
496-
output.write(contents.encode())
495+
with open(
496+
args.output if args.output else DOC_FILE, "w", newline="", encoding="utf-8"
497+
) as f:
498+
f.write(contents)

0 commit comments

Comments
 (0)