Commit f89d4e12 authored by Seth Brenith's avatar Seth Brenith Committed by Commit Bot

Don't write formatted tq files if nothing changed

This will prevent unnecessary recompilation effort on the subsequent
build, and avoids a common issue on Windows where format-torque replaces
all of the line endings in a .tq file without changing any actual
content.

Bug: v8:8805
Change-Id: Id695351c242739d92aef47cd09e651bfbe3c8f9a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1673456Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Reviewed-by: 's avatarTamer Tas <tmrts@chromium.org>
Commit-Queue: Tamer Tas <tmrts@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62357}
parent 6b52a54b
......@@ -120,14 +120,14 @@ def process(filename, lint, should_format):
print("error code " + str(rc) + " running clang-format. Exiting...")
sys.exit(rc);
if lint:
if (output != original_input):
if (output != original_input):
if lint:
print(filename + ' requires formatting', file=sys.stderr)
if should_format:
output_file = open(filename, 'w')
output_file.write(output);
output_file.close()
if should_format:
output_file = open(filename, 'w')
output_file.write(output);
output_file.close()
def print_usage():
print('format-torque -i file1[, file2[, ...]]')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment