Include directive sorter
authorTeemu Murtola <teemu.murtola@gmail.com>
Fri, 25 Jul 2014 04:02:44 +0000 (07:02 +0300)
committerGerrit Code Review <gerrit@gerrit.gromacs.org>
Thu, 11 Sep 2014 20:16:24 +0000 (22:16 +0200)
commit1bf821d461c749fbc34987c5b10f4527da782ba1
tree2f834ed48cfd764744980f57d21ccd6a48f39dc6
parentd191fe153c29168087ae76c7d672d7fcf217fbad
Include directive sorter

To facilitate discussion on how we want to sort the includes, the tool
supports a few different styles (with a --style option) that at least
roughly correspond to what has been proposed in #1557 or related
discussions.  Can be removed later when the final style is agreed on.

Having an automatic sorter also allows relatively easily using other
tools that may sort the includes as part of their operation (the
automatic sorter can just be run afterwards).

Made gmxtree.py aware of the location of the list of installer headers,
removing the need to pass the file on the command line.  This simplifies
manual invocation (in particular for the include sorter).

It only sorts a list of consecutive #include lines, possibly separated
by empty lines.  Comments between the lines or #ifdefs are left alone,
and only includes on both sides sorted independently.  This is by
design, as it keeps the script relatively simple, and also allows using
comments or similar to override the sorting for special cases.  Some
manual formatting may be required to make files with heavy use of
conditinal includes to look nice (to move headers to the appropriate
side of the #ifdefs), but after that, the tool should work quite well.

Add a git attribute to allow easily applying the script in combination
with a file list produced by admin/reformat_all.sh, and extend
reformat_all.sh such that it can be be run as
  admin/reformat_all.sh includesort -B=<builddir>
to sort all files with the attribute.

Related to #1557.

Change-Id: I362d7c5131a2e6952bbededfd51da4c4e1fc4a7e
.gitattributes
admin/reformat_all.sh
admin/uncrustify.sh
docs/doxygen/CMakeLists.txt
docs/doxygen/codelayout.md
docs/doxygen/doxygen-check.py
docs/doxygen/doxygenxml.py
docs/doxygen/gmxtree.py
docs/doxygen/graphbuilder.py
docs/doxygen/includesorter.py [new file with mode: 0755]
docs/doxygen/suppressions.txt