RFR: 8310948: Fix ignored-qualifiers warning in Hotspot
David Holmes
dholmes at openjdk.org
Mon Jul 3 00:32:56 UTC 2023
On Tue, 27 Jun 2023 12:22:43 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:
> Please review this attempt to fix ignored-qualifiers warning.
>
> Example warnings:
>
> src/hotspot/share/oops/method.hpp:413:19: warning: 'volatile' type qualifier on return type has no effect [-Wignored-qualifiers]
> CompiledMethod* volatile code() const;
> ^~~~~~~~~
>
>
> src/hotspot/share/jfr/periodic/jfrModuleEvent.cpp:65:20: warning: type qualifiers ignored on cast result type [-Wignored-qualifiers]
> 65 | event.set_source((const ModuleEntry* const)from_module);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> The proposed fix removes the ignored qualifiers.
> In a few AD files I replaced `const` with `constexpr` where I noticed that the method is returning a compile-time constant, and other platforms use `constexpr` on the same method.
>
> Release, debug and slowdebug builds on Aarch64 / x64 and Mac / Linux complete without errors. Cross-compile GHA builds also pass.
I will approve this as-is but have to wonder whether many of these cases of const return types were intending to declare const functions?
P.S. Forgot to say thanks for dealing with this!
src/hotspot/cpu/aarch64/aarch64.ad line 2288:
> 2286: //=============================================================================
> 2287:
> 2288: const bool Matcher::match_rule_supported(int opcode) {
Have to wonder if these were all meant to be `bool Match:xxx() const {`?
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/14674#pullrequestreview-1510051989
PR Comment: https://git.openjdk.org/jdk/pull/14674#issuecomment-1617042549
PR Review Comment: https://git.openjdk.org/jdk/pull/14674#discussion_r1249926982
More information about the build-dev
mailing list