Skip to content
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

8296926: Sort include lines of files in the include/ directory #11133

Conversation

stefank
Copy link
Member

@stefank stefank commented Nov 14, 2022

One of the more prevalent issues is that files in src/hotspot/share/include are not properly sorted. There has been some discussion that that was done on purpose, but it just adds another exception to the include rules that don't have any practical purposes, IMHO. It also goes against our written style guide around include files. One argument why it was OK have the files in include/ pushed up to the top of the sorted block, was that the file was included without specifying a directory. That's an argument that contradicts how we treat platform-dependent files, which (unfortunately) often also are specified without a prefixed directory. To remove this special case, I've removed the extraneous make file entry to have src/hotspot/share/include in the set of directories to search for headers when compiling HotSpot. Now all the header files in src/hotspot/share/include gets included by specifying the path from src/hotspot/share, just like the other platform-independent headers in HotSpot.

This RFE splits out the 'include/' changes from #11108 / JDK-8296886, so that those changes can be discussed separately.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8296926: Sort include lines of files in the include/ directory

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11133/head:pull/11133
$ git checkout pull/11133

Update a local copy of the PR:
$ git checkout pull/11133
$ git pull https://git.openjdk.org/jdk pull/11133/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11133

View PR using the GUI difftool:
$ git pr show -t 11133

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11133.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 14, 2022

👋 Welcome back stefank! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 14, 2022
@openjdk
Copy link

openjdk bot commented Nov 14, 2022

@stefank The following labels will be automatically applied to this pull request:

  • build
  • hotspot
  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added serviceability serviceability-dev@openjdk.org hotspot hotspot-dev@openjdk.org build build-dev@openjdk.org labels Nov 14, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 14, 2022

Webrevs

Copy link

@kimbarrett kimbarrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me.

Since the headers in the include/ directory are the interface exposed by HotSpot to the rest of the JDK, perhaps a better name might have been "hotspot" or "hotspot_api" or something like that. OTOH, the clients in the rest of the JDK include them without a directory, so the directory name doesn't matter to them. I'm fine with the existing name.

@openjdk
Copy link

openjdk bot commented Nov 14, 2022

@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:

8296926: Sort include lines of files in the include/ directory

Reviewed-by: kbarrett, erikj, lkorinth

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 4 new commits pushed to the master branch:

  • 196d021: 8297020: Rename GrowableArray::on_stack
  • 5f51dff: 8296776: Stop using mtNone as marker for CHeap allocations in GrowableArray
  • 499406c: 8285488: Improve DocFinder
  • 97ab2c3: 8296953: Fix a typo in exception documentation

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
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 master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 14, 2022
@dholmes-ora
Copy link
Member

Please rename share/include to something more meaningful e.g. share/export or share/hotspot (as Kim suggested). Software that contains an include directory typically also specifies -Iinclude/ so that you see #include "foo.h" not #include "include/foo.h". Thanks.

@stefank
Copy link
Member Author

stefank commented Nov 14, 2022

An alternative is to just that include/ is special, and shouldn't be specified, but then properly sort jvm.h and friends alphabetically, as specified in the Style Guide.

I'm fine with either solution, but I really want to remove this half measure that only some of the directory-less include lines are put at the top of the include block. If we are going to have such a special-case rule, then I'd argue that we should come up with a structure that is easy to explain and maintain, and write it down in our Style Guide.

@dholmes-ora
Copy link
Member

Okay I'm fine with jvm.h being placed in sort order rather than adding the include/ part. Thanks.

Copy link
Member

@erikj79 erikj79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build change looks good.

@stefank
Copy link
Member Author

stefank commented Nov 15, 2022

Build change looks good.

Thanks, Erik. Actually, that change should have been reverted with the last change. I'll revert that.

@stefank stefank changed the title 8296926: Use proper include lines for files in include/ 8296926: Sort include lines of files in the include/ directory Nov 16, 2022
Copy link
Contributor

@lkorinth lkorinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I prefer the original solution with path, I think the current version is also a good improvement. Approved. Thanks for fixing this!

@stefank
Copy link
Member Author

stefank commented Nov 16, 2022

Thanks for the reviews and discussions.
/integrate

@openjdk
Copy link

openjdk bot commented Nov 16, 2022

Going to push as commit 813b223.
Since your change was applied there have been 7 commits pushed to the master branch:

  • 8cdcec4: 8296774: Removed default MEMFLAGS value from CHeapBitMap
  • c3b285a: 8296916: RISC-V: Move some small macro-assembler functions to header file
  • 720c3d0: 8296932: G1: Remove unused G1RootClosures::weak_oops
  • 196d021: 8297020: Rename GrowableArray::on_stack
  • 5f51dff: 8296776: Stop using mtNone as marker for CHeap allocations in GrowableArray
  • 499406c: 8285488: Improve DocFinder
  • 97ab2c3: 8296953: Fix a typo in exception documentation

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 16, 2022
@openjdk openjdk bot closed this Nov 16, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 16, 2022
@openjdk
Copy link

openjdk bot commented Nov 16, 2022

@stefank Pushed as commit 813b223.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@dholmes-ora
Copy link
Member

Sorry I didn't get a chance to look at this yesterday. A belated "thumbs up".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build build-dev@openjdk.org hotspot hotspot-dev@openjdk.org integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
5 participants