Skip to content

DRAFT!!! Remove unneeded includes#32032

Draft
iklam wants to merge 3 commits into
openjdk:masterfrom
iklam:remove-unneeded-includes
Draft

DRAFT!!! Remove unneeded includes#32032
iklam wants to merge 3 commits into
openjdk:masterfrom
iklam:remove-unneeded-includes

Conversation

@iklam

@iklam iklam commented Jul 23, 2026

Copy link
Copy Markdown
Member

This is done semi-automatically with a Linux/x64 fastdebug build.

Manual testing is needed because run-clang-tidy reports some false positives.

$ make compile-commands
$ run-clang-tidy -p . -j 12 -checks='-*,misc-include-cleaner' \
     '.*/src/hotspot/share/runtime/.*\.(c|cc|cpp|cxx)$' > clang-tidy.txt  2>&1 

$ grep used.directly clang-tidy.txt
/repo/open/src/hotspot/share/runtime/stubRoutines.cpp:37:1: warning: included header align.hpp is not used directly [misc-include-cleaner]
/repo/open/src/hotspot/share/runtime/stubRoutines.cpp:40:1: warning: included header runtime.hpp is not used directly [misc-include-cleaner]

I have a script that tries all the suggestions of clang-tidy.txt. E.g.,

  • Edit stubRoutines.cpp to change the include to //NONEED #include "utilities/align.hpp"
  • Rebuild stubRoutines.o.
    • If all goes well, leave the line as is.
    • If the build fails, change the line to /*NEED*/ #include "utilities/align.hpp"

After about 100 fixes, I run the repo in our Mach5 CI to build on a wide range of platforms and configurations. Change the //NONEED to /*NEED*/ when failures are found. Usually failures happen only with a small number of lines.

Do the above for a few iterations. When I am happy with the changes, I will run another script to remove all the //NONEED lines, and also remove all the /*NEED*/ comments.



Progress

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

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 32032

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

Using diff file

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

@bridgekeeper

bridgekeeper Bot commented Jul 23, 2026

Copy link
Copy Markdown

👋 Welcome back iklam! 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 commented Jul 23, 2026

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot added the hotspot hotspot-dev@openjdk.org label Jul 23, 2026
@openjdk

openjdk Bot commented Jul 23, 2026

Copy link
Copy Markdown

@iklam The following label will be automatically applied to this pull request:

  • hotspot

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

@openjdk

openjdk Bot commented Jul 23, 2026

Copy link
Copy Markdown

The total number of required reviews for this PR has been set to 2 based on the presence of this label: hotspot. This can be overridden with the /reviewers command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot hotspot-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

1 participant