style: normalize filename in SortedIncludes.fix()
authorGeorg Kotheimer <georg.kotheimer@mailbox.tu-dresden.de>
Thu, 31 May 2018 09:24:18 +0000 (11:24 +0200)
committerBobby R. Bruce <bbruce@ucdavis.edu>
Tue, 1 Oct 2019 22:38:11 +0000 (22:38 +0000)
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>

util/style/verifiers.py

index 33b127a79cada410e1d6bd76a12a2001f5728fdf..3cc5134291279cf1fed746823e84754729832232 100644 (file)
@@ -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)