-
Notifications
You must be signed in to change notification settings - Fork 728
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
Add 'const' qualifier to some string parameters #18083
Conversation
Could you review when you get a chance Henry @hzongaro? |
I don't have a problem with these changes in principle, but I wanted to check whether there's been some historical discussion in OpenJ9 or OMR — possibly from before the point at which the projects were open-sourced — about the use of One thing that looks a bit odd, for instance, is this change to Daryl @0xdaryl, are you aware of any past debate/decisions on how these sorts of cases ought to be handled in the JIT compiler? Is Also, we have various other methods that are processing similar kinds of arguments but that have other signatures. It's not clear whether they weren't included in this change simply because they're never called with [1] openj9/runtime/compiler/env/VMJ9.cpp Lines 6567 to 6574 in e5cb3a3
[2] openj9/runtime/compiler/env/VMJ9.h Line 444 in e5cb3a3
|
Now that you mention it, I haven't really considered the lack of consistency with the way I've been doing things. So far I've just been sifting through the warnings in the build log and fixing them, figuring that once they were all fixed and we turned warnings-as-errors on, the error would alert whoever was trying to pass a literal into a function that expects a An interesting lesson that nothing is ever as straightforward as it may seem... |
From some off-line discussion of my earlier comment, we concluded that while it would be desirable to have consistency in the various APIs that use |
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 think the changes look good, but I notice in JITClientCompilationThread.cpp
a call to one of the getInstanceFieldOffset
methods that appears to be explicitly casting away the "constness" of a const char *
pointer. I think the uses of const_cast<char *>
in that call can be removed.
I also notice an RWMonitor
class that has an init(char *name)
method. Although it isn't part of the hierarchy for TR::Monitor
, I think it would make sense for its argument to be const char *
for consistency.
e5cb3a3
to
a3acdc0
Compare
I think that should do it! |
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. Thanks!
Jenkins test sanity all jdk8,jdk11,jdk17,jdk21 |
a3acdc0
to
039e75c
Compare
Fix a warning about string literals being assigned to non-const char pointers in getInstanceFieldOffset related functions, TR_AddressSet::traceDetails, and J9::Monitor::create by adding a 'const' qualifier to their string parameters Signed-off-by: Dylan Tuttle <[email protected]>
039e75c
to
5ace1d3
Compare
Jenkins test sanity all jdk8,jdk11,jdk17,jdk21 |
zLinux test failures are all affecting CRIU test
JDK 8 x86-32 Windows test failure in cmdLineTest_J9test_elapsedTime_0 appears to be due to issue #18487. |
Ran some additional internal builds on AIX, z/OS, Windows, macOS. No unexpected failures. Merging. |
Work towards fixing AIX warnings about assigning string literals to non-const char pointers by adding a 'const' qualifier to string parameters in getInstanceFieldOffset related functions, TR_AddressSet::traceDetails, and J9::Monitor::create.
Contributes to (but does not close) #14859