summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Kotheimer <georg.kotheimer@mailbox.tu-dresden.de>2018-05-31 11:24:18 +0200
committerBobby R. Bruce <bbruce@ucdavis.edu>2019-10-01 22:38:11 +0000
commit7e1b5bd3bc21a324694e9a892ee6d5219ee7505f (patch)
tree26e8ddfa04393d996e069230892efd6ff06d1285
parent6c9f86e7e3dc1983e556d4f0db135118a91afa34 (diff)
downloadgem5-7e1b5bd3bc21a324694e9a892ee6d5219ee7505f.tar.xz
style: normalize filename in SortedIncludes.fix()
The filename affects the sorting result. Therefore check(), which normalizes the filename, detects an invalid sorting of includes, but fix() fails to fix the corresponding includes. Change-Id: I7d5a941c9ebea853004922d19e3b84f8ded2afa6 Signed-off-by: Georg Kotheimer <georg.kotheimer@mailbox.tu-dresden.de> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/10742 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
-rw-r--r--util/style/verifiers.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/util/style/verifiers.py b/util/style/verifiers.py
index 33b127a79..3cc513429 100644
--- a/util/style/verifiers.py
+++ b/util/style/verifiers.py
@@ -378,11 +378,12 @@ class SortedIncludes(Verifier):
@safefix
def fix(self, filename, regions=all_regions):
f = self.open(filename, 'r+')
+ norm_fname = self.normalize_filename(filename)
old = f.readlines()
lines = [ l.rstrip('\n') for l in old ]
language = lang_type(filename, lines[0])
- sort_lines = list(self.sort_includes(lines, filename, language))
+ sort_lines = list(self.sort_includes(lines, norm_fname, language))
new = ''.join(line + '\n' for line in sort_lines)
f.seek(0)