-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8323158: HotSpot Style Guide should specify more include ordering #23388
base: master
Are you sure you want to change the base?
Conversation
👋 Welcome back stefank! A progress list of the required criteria for merging this PR into |
@stefank This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 92 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
Webrevs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of minor wording nits. Otherwise looks good to me.
A lot of these rules looks like they could be checked with some simple scripting or additions to jcheck. Have you considered that? |
I haven't felt the urge to write such a script, but I know that others have scripts to sort the includes. |
Ok, it was just a suggestion. My experience is that while clearly written conventions/rules are important, the more they can be automated, the less hassle for everyone. |
I agree, that a script is beneficial. Do you know of anyone that would be willing to help out and write such script? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally seems fine. Thanks.
<li><p>Put conditional inclusions (`#if ...`) at the end of the section of HotSpot | ||
include lines. This also applies to macro-expanded includes of platform | ||
dependent files.</p></li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the order for the conditional sections? Alphabetic on the include guard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a set order. I wouldn't mind making it alphabetic with platforms includes coming before the other conditional includes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I also tend to sort the forward declarations but that's also not something that everyone does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, I also tend to sort the forward declarations but that's also not something that everyone does.
I, too, am an obsessive sorter. Clean code is good code.
We could use clang-format for these specific include rules. For example, when we still had
Implementing all of the rules for Clang format is left as an exercise to the reader, and the author would be very appreciative if someone posted their solution here :-). |
The HotSpot Style Guide has a section about source files and includes. The style used for includes have mostly been introduced by scripts when includeDB was replaced, but also when various other enhancements to our includes were made. Some of the introduced styles were never written down in the style guide.
I propose a couple of changes to the HotSpot Style Guide to reflect some of these implicit styles that we have. While updating the text I also took the liberty to order the items in an order that I felt was good.
Note that JDK-8323158 contains a few more suggestions, but I've only addressed the items that I think can be accepted without much contention. Either I extract the items that have not been address into a new RFE, or I create a new RFE for this PR.
There a some small whitespace tweaks that I made so that the .md and .html had a similar layout.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23388/head:pull/23388
$ git checkout pull/23388
Update a local copy of the PR:
$ git checkout pull/23388
$ git pull https://git.openjdk.org/jdk.git pull/23388/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23388
View PR using the GUI difftool:
$ git pr show -t 23388
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23388.diff
Using Webrev
Link to Webrev Comment