This PR adds `bin/sort_includes.py`, a python3 script to check that blocks of 
include statements in C++ files are sorted alphabetically and that there's at 
least one blank line between user and sys includes (as per the [style 
guide](https://github.com/openjdk/jdk/blob/master/doc/hotspot-style.md#source-files)).
This script can also update files with unsorted includes. The second commit in 
this PR shows the result of running:

python3 ./bin/sort_includes.py ./src/hotspot

To prevent an include being reordered, put at least one non-space character 
after the closing `"` or `>`. See `src/hotspot/share/adlc/archDesc.cpp` for an 
example.

Assuming this PR is integrated, jcheck could be updated to use it to ensure 
include statements remain sorted.

-------------

Commit messages:
 - do not reorder includes in immediate_aarch64.cpp
 - do not reorder includes in systemMemoryBarrier_windows.cpp
 - sort include statements in hotspot
 - added tool to sort includes

Changes: https://git.openjdk.org/jdk/pull/24180/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24180&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8352645
  Stats: 1489 lines in 437 files changed: 799 ins; 653 del; 37 mod
  Patch: https://git.openjdk.org/jdk/pull/24180.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/24180/head:pull/24180

PR: https://git.openjdk.org/jdk/pull/24180

Reply via email to