summaryrefslogtreecommitdiff
path: root/util/sort_includes.py
AgeCommit message (Collapse)Author
2016-03-30style: Refactor the style checker as a Python packageAndreas Sandberg
Refactor the style checker into a Python module that can be reused by command line tools that integrate with git. In particular: * Create a style package in util * Move style validators from style.py to the style/validators.py. * Move style verifiers from style.py to the style/verifiers.py. * Move utility functions (sort_includes, region handling, file_types) into the style package * Move generic code from style.py to style/style.py. Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Steve Reinhardt <steve.reinhardt@amd.com> --HG-- rename : util/style.py => util/hgstyle.py rename : util/sort_includes.py => util/style/sort_includes.py extra : rebase_source : ad6cf9b9a18c48350dfc7b7c77bea6c5344fb53c
2016-03-30style: Change include sorter to yield one line at a timeAndreas Sandberg
The include sorter class normally yields one string per line and relies on the caller to merge lines into a block of text separated by newlines. However, there are cases when this isn't true. This makes diffing using Python's difflib hard. This changeset updates the include sorter to never do this and always yield one line at a time. Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Curtis Dunham <curtis.dunham@arm.com> Reviewed-by: Steve Reinhardt <steve.reinhardt@amd.com> --HG-- extra : rebase_source : 154c9c7e1ebdd77e09fe5f28d0cfddc9e6c6b1eb
2016-03-29copyright: Update copyright in sort_includes.pyAndreas Sandberg
The following changes introduced substantial changes to sort_includes.py: - hg:84b4d6af0ecc - util: Fix state leakage in ... - hg:e2f9644a7738 - style: Update the style checker to handle new ... Since the file didn't include a copyright header at the time, I never added the correct ARM copyright notice. This changeset adds the correct copyright notice. Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
2016-03-28copyright: add copyright missing from files I createdNathan Binkert
2015-02-03style: Update the style checker to handle new include orderAndreas Sandberg
As of August 2014, the gem5 style guide mandates that a source file's primary header is included first in that source file. This helps to ensure that the header file does not depend on include file ordering and avoids surprises down the road when someone tries to reuse code. In the new order, include files are grouped into the following blocks: * Primary header file (e.g., foo.hh for foo.cc) * Python headers * C system/stdlib includes * C++ stdlib includes * Include files in the gem5 source tree Just like before, include files within a block are required to be sorted in alphabetical order. This changeset updates the style checker to enforce the new order.
2014-08-13util: Fix state leakage in the SortIncludes style verifierAndreas Sandberg
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.
2011-04-15util: python implementation of a routine that will sort includesNathan Binkert
I didn't realize that the perl version existed when I started this, this version has a lot more features than the previous one since it will sort and separate python, system, and m5 headers in separate groups, it will remove duplicates, it will also convert c headers to stl headers