RFR: 8252136: Several methods in hotspot are missing "static" [v2]

Kim Barrett kbarrett at openjdk.org
Thu Feb 15 03:08:05 UTC 2024


On Tue, 13 Feb 2024 10:29:48 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleWriter.cpp line 202:
>> 
>>> 200: static RootDescriptionInfo* root_infos = nullptr;
>>> 201: 
>>> 202: static int __write_sample_info__(JfrCheckpointWriter* writer, const void* si) {
>> 
>> pre-existing: all these names starting with underscores are technically reserved names - C++14 17.6.4.3.2.
>> Shouldn't be changed as part of this PR, but perhaps there should be a bug report?  Don't know if anyone
>> would ever get around to doing anything about it though.
>
> Please feel free to open a bug report. 😉 
> 
> Unless there is a warning flag to avoid creating reserved names (is there?), it is more of a matter of coding style on the part of Hotspot, and that is basically where I draw the line of my meddling with Hotspot. :)

I just discovered that Clang 13 added `-Wreserved-identifier`.  There's also an open gcc bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51437

And a discussion of the "chattiness" of the feature:
https://github.com/llvm/llvm-project/issues/57913#issuecomment-1255493025

Probably there's not much appetite for this sort of thing, and I shouldn't have brought it up.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17806#discussion_r1490315316


More information about the serviceability-dev mailing list