style: Update the style checker to handle new include order
Review Request #2614 - Created Jan. 26, 2015 and submitted
| Information | |
|---|---|
| Andreas Hansson | |
| gem5 | |
| default | |
| Reviewers | |
| Default | |
Changeset 10669:e82b485546d1 --------------------------- style: Update the style checker to handle new include order 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.
Posted (Jan. 27, 2015, 2:07 p.m.)
A swift review of this would be appreciated since mercurial is not playing along very well with this as part of a patch queue.
Posted (Jan. 27, 2015, 3:57 p.m.)
This is a welcome change. We're still finessing includes-ordering in gem5-gpu, and this change subsumes some of the unofficial policies we're following. Just a couple minor code style comments below.
-
util/sort_includes.py (Diff revision 1) -
The Python "do X if Y else Z" conditional formatting tends to be unclear and tricky to read, as is the case here. It's also quite uncommon in gem5 (in fact, I'm unable to quickly find another example in the codebase), and using it in line 61 and here mixes code style with the more standard use in analogous line 100. My preference would be to maintain the clearer and consistent use of if-conditionals already common in gem5.
-
util/sort_includes.py (Diff revision 1) -
This and lines 154+155 are tricky to read also. The old code was much clearer/easier to step through. Is it important for the code to be this dense?
Review request changed
Updated (Jan. 28, 2015, 3:56 a.m.)
Description: |
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Diff: |
Revision 2 (+161 -109) |
Cool. Looks good to me. Thanks for the style dialog.
