changeset 84b4d6af0ecc in /z/repo/gem5 details: http://repo.gem5.org/gem5?cmd=changeset;node=84b4d6af0ecc description: util: Fix state leakage in the SortIncludes style verifier
There are cases where the state of a SortIncludes object gets messed up and leaks between invocations/files. This typically happens when a file ends with an include block (dump_block() gets called at the end of __call__). In this case, the state of the class is not reset between files. This bug manifests itself as ghost includes that leak between files when applying the style hooks. This changeset adds a reset at the beginning of the __call__ method which ensures that the class is always in a clean state when processing a new file. diffstat: util/sort_includes.py | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diffs (20 lines): diff -r 68da5ef4bb6f -r 84b4d6af0ecc util/sort_includes.py --- a/util/sort_includes.py Wed Aug 13 06:57:24 2014 -0400 +++ b/util/sort_includes.py Wed Aug 13 06:57:25 2014 -0400 @@ -72,7 +72,7 @@ includes_re = tuple((a, b, re.compile(c)) for a,b,c in includes_re) def __init__(self): - self.reset() + pass def reset(self): # clear all stored headers @@ -103,6 +103,7 @@ prev = l def __call__(self, lines, filename, language): + self.reset() leading_blank = False blanks = 0 block = False _______________________________________________ gem5-dev mailing list gem5-dev@gem5.org http://m5sim.org/mailman/listinfo/gem5-dev