JDK-8338236 : Compile error in cgroup code on Linux when using clang
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2024-08-12
  • Updated: 2025-07-02
  • Resolved: 2024-08-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 21 JDK 24
21.0.9Fixed 24 b11Fixed
Related Reports
Causes :  
Relates :  
Description
When building with
Ubuntu clang version 14.0.0-1ubuntu1.1

we run into the following compile error  (seen on Linux ppc64le, probably also an error on x86_64) :

/jdk/src/hotspot/os/linux/cgroupV1Subsystem_linux.hpp:65:10: error: 'is_read_only' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    bool is_read_only() { return _read_only; }
         ^
/jdk/src/hotspot/os/linux/cgroupSubsystem_linux.hpp:108:18: note: overridden virtual function is here
    virtual bool is_read_only() = 0;
                 ^
In file included from /jdk/src/hotspot/os/linux/cgroupSubsystem_linux.cpp:30:
/jdk/src/hotspot/os/linux/cgroupV2Subsystem_linux.hpp:131:54: error: 'memory_controller' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
    CachingCgroupController<CgroupMemoryController>* memory_controller() { return _memory; }
                                                     ^
/jdk/src/hotspot/os/linux/cgroupSubsystem_linux.hpp:235:62: note: overridden virtual function is here
    virtual CachingCgroupController<CgroupMemoryController>* memory_controller() = 0;
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/1663 Date: 2025-04-16 10:55:45 +0000
01-07-2025

Fix request (21u) - but only for the October release I'd like to port JDK-8338236 to 21u as discussed in: [21u] Backport intention of 8322420: [Linux] cgroup v2: Limits in parent nested control groups are not detected https://mail.openjdk.org/pipermail/jdk-updates-dev/2025-March/042592.html This is a PR 5 of 6 in this series, it has a patch dependency on PR of JDK-8331560. This backport is clean.
17-04-2025

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk21u-dev/pull/1652 Date: 2025-04-15 13:28:03 +0000
15-04-2025

> Perhaps the warning-enabled-by-default is only true for some more restricted cases, like having a pure virtual with a derived class not annotating the function as either virtual or override According to https://stackoverflow.com/questions/29145476/requiring-virtual-function-overrides-to-use-override-keyword and https://reviews.llvm.org/D82728 "Clang already has -Winconsistent-missing-override, which only warns in the case where there is at least one function already marked override in a class. " the inconsistent-missing-override warning is indeed less "aggressive".
14-08-2024

I'm astonished that these are the only such warnings. Perhaps the warning-enabled-by-default is only true for some more restricted cases, like having a pure virtual with a derived class not annotating the function as either virtual or override?
14-08-2024

The "xyz overrides a member function but is not marked 'override' " warning can be seen both with clang14 (Linux) and clang15 (macOS), even without setting additional warning flags.
14-08-2024

Changeset: 38bd8a36 Branch: master Author: Matthias Baesken <mbaesken@openjdk.org> Date: 2024-08-14 09:52:23 +0000 URL: https://git.openjdk.org/jdk/commit/38bd8a36704a962f0ad1052fd2ec150a61663256
14-08-2024

[~kbarrett] should I try to disable the warning ?
14-08-2024

A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20562 Date: 2024-08-13 07:59:11 +0000
13-08-2024