-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
8294314: Minimize disabled warnings in hotspot #10414
Conversation
…updated with VarDeps
👋 Welcome back ihse! A progress list of the required criteria for merging this PR into |
/label add hotspot |
Webrevs
|
@magicus |
It turned out GHA had problems, with the cross-compiled platforms. I'll fix those. |
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 like the general idea. In particular, the file-specific disables provide a
nice list of bite-sized potential cleanup RFEs.
However, shift-negative-value should remain globally disabled for gcc/clang;
see https://bugs.openjdk.org/browse/JDK-8240259.
There might be other warnings that should remain globally disabled; I've not
gone through the list carefully yet.
There used to be more comments around the warning disables. The Windows ones |
@kimbarrett That must have been in the old hotspot build system then. We are now nearing a point were we have so few disabled warnings that it makes sense to write down some rationale for those we have left, at least those which are globally (I assume you mean "for hotspot" with "globally" :-)) disabled. There is also a list of truly globally disabled warnings (for all native code in the JDK, not only hotspot). These should need some reviewing as well, and if we agree to keep them globally disabled, a rationale can be provided. If the documentation tends to be to long and rambling, we might need to put it elsewhere than as comments in the makefiles though, perhaps as a separate document. I can make a summary of the warnings that are no longer globally disabled with this fix, so you can check if some of them should be (even if they are not triggering anything right now). Also note that I ran into a lot of trouble with the cross-compilation on GHA, so I'll have to either replicate those locally, or fight a bit with GHA to get progress more than one file at a time. In any case, it will take a while for me to sort out. |
I see the failure due to
...which is weird, given there is an exclude:
I have a full cross-compilation setup on my Ubuntu 22.04 machine, which matches what GHA is doing, let me see if this PR passes with it. |
I ran all {x86_32, x86_64, aarch64, arm, powerpc64le, arm, riscv64} x {server} x {release,fastdebug} with GCC 10, and these are the new additions:
Unfortunately, in s390x case, the warning is in I shall deal with |
Current PR at d6c52a2 passes the matrix of:
It only took ~400 CPU-hours, ~600 GB of disk space, and ~1 kWh to build :P |
make/hotspot/lib/CompileJvm.gmk
Outdated
|
||
DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value | ||
|
||
DISABLED_WARNINGS_microsoft := 4100 4127 4146 4201 4244 4291 4351 \ | ||
4511 4512 4514 4624 | ||
DISABLED_WARNINGS_microsoft := 4624 4244 4291 4146 |
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 went through the list of Visual Studio warnings being removed from the
global suppression list.
clang: tautological-compare
windows: 4127 - conditional expression is constant
I'm not sure we want these turned on. This is the kind of thing that can
happen quite easily with macros and/or in a code base that uses things like
conditional compilation to support multiple platforms. Working around these
warnings when they arise can make for significant code uglification. OTOH, I
guess it could catch some programming mistakes. Maybe these could remain
surppressed for this change, and discussed separately?
4100 - 'identifier': unreferenced formal parameter
I'm very surprised removing this doesn't cause problems, as I'm sure I've seen
named but unused parameters. Maybe they've been cleaned up over time? I think
some compiler (probably Visual Studio) used to be unhappy with unnamed
parameters, which made this hard to avoid in some cases. Fortunately, that
doesn't seem to be a problem anymore.
Removal okay.
4201 - nonstandard extension used: nameless struct/union
Removal okay.
4351 - new behavior: elements of array ‘array’ will be default initialized (according to google, but it is undocumented!!!)
This one seems to have been dropped by more recent versions of VS.
There are places where we use the feature, expecting the new behavior.
Removal okay.
4511 - 'class': copy constructor was implicitly defined as deleted
4512 - 'class': assignment operator was implicitly defined as deleted
I think that if the indicated situations were to exist and the warnings hadn't
been suppressed that we'd get link-time errors instead.
Removal okay.
4514 - 'function': unreferenced inline function has been removed
I think we don't want this turned on, but it's also off by default.
Removal okay.
Also consider transplanting the |
Hey @magicus, are you going forward with this PR, or? |
Yes, that is my intention. I've been away for almost two weeks, taking care of my kids and then getting ill myself. :-( I'm wading through my backlog, and intend to get back to this very soon. Note to self Remaining to be done:
|
…disabling framework (maybe-uninitialized is always turned off so skip those files)
@shipilev In a "tenth time's the charm" spirit, here's what I do think is actually a PR that can be integrated. (This one was really messy, both due to me being a bit sloppy and too trigger-happy at times, and due to the complex situation of changing warnings across multiple combinations of variants, compilers, platforms, etc.) |
Cool! I'll try to schedule the overnight build-matrix run to see if anything is broken. |
Thanks. Maybe you can make some coffee of that excess 1 kWh heat? ;) |
@magicus 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 22 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 |
shift-negative-value unknown-pragmas | ||
|
||
DISABLED_WARNINGS_clang := ignored-qualifiers sometimes-uninitialized \ | ||
missing-braces delete-non-abstract-non-virtual-dtor unknown-pragmas |
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.
Shouldn't shift-negative-value be in the clang list too?
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.
Well, there is currently no instance of clang complaining about this. This could be due to:
- This warning does not really exist on clang
- Or it is not enabled by our current clang flags
- Or the code which triggers the warning in gcc is not reached by clang
- Or clang is smarter than gcc and can determine that the usage is ok after all
- Or clang is dumber than gcc and does not even see that there could have been a problem...
...
I'm kind of reluctant to add warnings to this list that have not occurred for real. My suggestion is that we add it here if we ever see it making incorrect claims. Ok?
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'm worried about someone encountering it and uglifying code to work around
it. OTOH, I don't know why we're not seeing this warning with clang, as there
is shared code that should trigger it (and does for gcc). So I'm okay with it
as is.
I was able to build the matrix of:
All these build with default warnings enabled, and they pass. So I think we are more or less safe with this minimization. |
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 good.
I think you want to do the actual "Approve" to supersede your previous "Request changes" review. Anyway, I think we are good for integration here, @magicus? |
/integrate |
Going to push as commit 7743345.
Your commit was automatically rebased without conflicts. |
After JDK-8294281, it is now possible to disable warnings for individual files instead for whole libraries. I used this opportunity to go through all disabled warnings in hotspot.
Any warnings that were only triggered in a few files were removed from hotspot as a whole, and changed to be only disabled for those files.
Some warnings didn't trigger in any file anymore, and could just be removed.
Overall, this reduced the number of disabled warnings by roughly half for gcc, clang and visual studio. The remaining warnings are sorted in "frequency", that is, the first listed warnings are triggered in the most number of files, while the last in the fewest number of files. So if anyone were to try to address the remaining warnings, it would make sense to chop of this list from the back.
I believe the warnings that are disabled on a per-file basis can most likely be fixed relatively easily.
I have verified this by Oracle's internal CI system, and GitHub Actions. (But I have not yet gotten a fully green run due to instabilities in GHA, however this patch can't reasonably have anything to do with that.) As always, warnings tend to differ a bit between compilers, so if someone wants to take this on a spin with some other version, please go ahead. If I missed some warning, in worst case we'll just have to add it back again, and in the meanwhile
configure --disable-warnings-as-errors
is an okay workaround.It also turned out that JDK-8294281 did not save the new per-file warnings in VarDeps, so I had to move $1_WARNINGS_FLAGS from $1_BASE_CFLAGS to $1_CFLAGS (and similar for C++).
Annoyingly, the assert macro triggers
tautological-constant-out-of-range-compare
on clang, so while this is a single problem in a single file, this erupts all over the place in debug builds. If this can be fixed, the ugly extraDISABLED_WARNINGS_clang += tautological-constant-out-of-range-compare
for non-release builds can be removed.Progress
Issue
Reviewers
Contributors
<shade@openjdk.org>
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10414/head:pull/10414
$ git checkout pull/10414
Update a local copy of the PR:
$ git checkout pull/10414
$ git pull https://git.openjdk.org/jdk pull/10414/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10414
View PR using the GUI difftool:
$ git pr show -t 10414
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10414.diff