jdk icon indicating copy to clipboard operation
jdk copied to clipboard

8294438: Fix misleading-indentation warnings in hotspot

Open shipilev opened this issue 3 years ago • 6 comments

There are number of places where misleading-indentation is reported by GCC. Currently, the warning is disabled for the entirety of Hotspot, which is not good.

C1 does an unusual style here. Changing it globally would touch a lot of lines. Instead of doing that, I fit the existing style while also resolving the warnings. Note this actually solves a bug in lir_alloc_array, where do_temp are called without a check.

Build-tested this with product of:

  • GCC 10
  • {i686, x86_64, aarch64, powerpc64le, s390x, armhf, riscv64}
  • {server, zero}
  • {release, fastdebug}

Linux x86_64 fastdebug tier1 is fine.


Progress

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

Issue

  • JDK-8294438: Fix misleading-indentation warnings in hotspot

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10444

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

Using diff file

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

shipilev avatar Sep 27 '22 10:09 shipilev

:wave: Welcome back shade! 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.

bridgekeeper[bot] avatar Sep 27 '22 10:09 bridgekeeper[bot]

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

  • build
  • hotspot
  • shenandoah

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[bot] avatar Sep 27 '22 10:09 openjdk[bot]

So enabling the warning actually exposed a bug? That's always nice to see, and a good argument for keeping up with the hygiene work of minimizing the amount of disabled warnings.

magicus avatar Sep 27 '22 11:09 magicus

So enabling the warning actually exposed a bug? That's always nice to see, and a good argument for keeping up with the hygiene work of minimizing the amount of disabled warnings.

Yes. It is hard to judge how innocuous that bug really is, because (handwaves) compilers.

shipilev avatar Sep 27 '22 11:09 shipilev

Webrevs

mlbridge[bot] avatar Sep 27 '22 12:09 mlbridge[bot]

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

8294438: Fix misleading-indentation warnings in hotspot

Reviewed-by: ihse, dholmes, coleenp

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 no new commits pushed to the master branch. If another commit should be pushed before you perform the /integrate command, your PR will be automatically rebased. If you prefer to avoid any potential 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[bot] avatar Sep 27 '22 14:09 openjdk[bot]

Thanks!

/integrate

shipilev avatar Oct 20 '22 07:10 shipilev

Going to push as commit 545021b18d6f82ac8013009939ef4e05b8ebf7ce. Since your change was applied there have been 4 commits pushed to the master branch:

  • c5e0464098f8f7cd9c568c7b1c3a06139453eaab: 8291456: com/sun/jdi/ClassUnloadEventTest.java failed with: Wrong number of class unload events: expected 10 got 4
  • 8d4c077218748d37617fc1bdb537a165706a5849: 8295302: Do not use ArrayList when LambdaForm has a single ClassData
  • 017e7988b197427f6b464303788a418a1d892ab9: 8293939: Move continuation_enter_setup and friends
  • f872467d69a6d8442f8004609ce819641cab568b: 8255746: Make PrintCompilation available on a per method level

Your commit was automatically rebased without conflicts.

openjdk[bot] avatar Oct 20 '22 07:10 openjdk[bot]

@shipilev Pushed as commit 545021b18d6f82ac8013009939ef4e05b8ebf7ce.

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

openjdk[bot] avatar Oct 20 '22 07:10 openjdk[bot]

@shipilev this has broken our linux aarch64 builds!

[2022-10-20T07:26:59,542Z] workspace/open/src/hotspot/cpu/aarch64/assembler_aarch64.cpp: In member function 'void Address::lea(MacroAssembler*, Register) const': [2022-10-20T07:26:59,542Z] workspace/open/src/hotspot/cpu/aarch64/assembler_aarch64.cpp:138:5: error: this 'else' clause does not guard... [-Werror=misleading-indentation] [2022-10-20T07:26:59,542Z] 138 | else [2022-10-20T07:26:59,542Z] | ^~~~ [2022-10-20T07:26:59,542Z] workspace/open/src/hotspot/cpu/aarch64/assembler_aarch64.cpp:140:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else' [2022-10-20T07:26:59,542Z] 140 | break; [2022-10-20T07:26:59,542Z] | ^~~~~

dholmes-ora avatar Oct 20 '22 07:10 dholmes-ora

@shipilev this has broken our linux aarch64 builds!

Whoa. Looking.

shipilev avatar Oct 20 '22 07:10 shipilev

@shipilev this has broken our linux aarch64 builds!

Whoa. Looking.

That would be: #10781

shipilev avatar Oct 20 '22 07:10 shipilev