-
Notifications
You must be signed in to change notification settings - Fork 402
Remove isdigit macro redefs, replace with OMR_ISDIGIT #7711
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
base: master
Are you sure you want to change the base?
Conversation
@keithc-ca I unintentionally closed #7413 due to a force push earlier. Don't think I could reopen that, so I created this with the cleaned up suggestions. I verified the advice by the cpp-team and made the replacements across omr and openj9, and also tested with both XLC and Open XL compilation and confirmed that this builds with the jdk21 zos with no issues for both. The corresponding changes for OpenJ9 are here: eclipse-openj9/openj9#21555 @babsingh Tagging for review/additional feedback, updates from #7413 |
compiler/control/OMROptions.cpp
Outdated
@@ -1376,7 +1378,7 @@ OMR::Options::getNumericValue(const char *& option) | |||
while (pendingOperation) | |||
{ | |||
int64_t current = 0; | |||
while (isdigit(*option)) | |||
while (__isdigit_a(*option)) |
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 don't think it's reasonable to define _AE_BIMODAL
on all platforms, nor is it reasonable to assume that __isdigit_a()
exists on all platforms.
I suggest we should introduce helper macros (e.g. omr_isdigit()
) which would be suitably defined for each platform and uses of isdigit()
would be replaced by uses of omr_isdigit()
. The same approach should be applied for toupper()
, tolower()
, etc.
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.
Sounds good, I can define that in util/a2e/headers/ctype.h
I guess.
Is there a __tolower_a()
and __toupper_a()
similarly available as well? Not able to find documentation around 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.
No. omr_isdigit()
would be defined in some OMR header file (perhaps after including ctype.h
).
compiler/control/OMROptions.cpp
Outdated
{ | ||
count[i] = atoi(s); | ||
while(isdigit(s[0])) | ||
while(OMR_ISDIGIT(s[0])) |
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.
While you're here, please add the missing space after while
; see also lines 4421, 4444 and changes in other files.
#endif /* defined(J9ZOS390) */ | ||
|
||
#include <sstream> |
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.
This was previously not included on z/OS: Have you verified that it is now safe to include?
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.
In the before code, I am seeing #include <sstream>
in the J9ZOS390
clause already, inbetween the undef and defines.
That being said, it seems to be safe to include so far while compiling as well.
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.
Sorry, I misread the change. You are correct, sstream
was included on all platforms before and should continue to be.
@@ -23,6 +23,8 @@ | |||
#ifndef OMRCOMP_H | |||
#define OMRCOMP_H | |||
|
|||
#define _AE_BIMODAL |
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 this should be conditional:
#if defined(J9ZOS390)
#define _AE_BIMODAL
#endif /* defined(J9ZOS390) */
The summary and description should be updated to reflect the new plan. |
Changes here remove the redefinition of isdigit() in the a2e ctype.h headers. In order to fully make this work functionally, the references/usages of isdigit() are replaced with OMR_ISDIGIT to properly recognize ascii digit literals. This is done by conditionally using __isdigit_a() on z/OS platforms. Signed-off-by: Gaurav Chaudhari <[email protected]>
After having implemented the feedback, with the latest combination of changes from this and eclipse-openj9/openj9#21555 I am seeing the below errors:
From this it looks like |
No, that doesn't sound right: That should be contained to the header file that defines |
Strange ... I am trying to remove the If that doesn't work either, then not sure why EDIT: Also trying to include <ctype.h> within |
Changes here remove the redefinition of isdigit() in
the a2e ctype.h headers. In order to fully make this
work functionally, the references/usages of isdigit()
are replaced with OMR_ISDIGIT to properly recognize
ascii digit literals. This is done by conditionally
using __isdigit_a() on z/OS platforms.
This is the cleaned-up changes from #7413 (for historical related comments)