-
Notifications
You must be signed in to change notification settings - Fork 400
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
Remove macro redefinitions that cause issues with Open XL #7413
base: master
Are you sure you want to change the base?
Conversation
jenkins build zos |
Can you confirm this builds successfully with OpenJ9 (mainly because that is a broader test base than what OMR provides)? @keithc-ca FYI since it is in DDR code. |
That OMR build specifies I did notice that the macros in stricmp.c are just wrong for EBCDIC (letters are not contiguous). |
I assume this question is for @Deigue. |
Yes, the author. |
j21 build actually seems like it is not passing with the changes
@keithc-ca is this being caused by the redefinitions being missing, or is it pointing to something else? wasn't sure what Error 12 meant, and the main error I see is this: |
@Deigue What is the original error that you are trying to resolve with this fix? |
Here is the snippet of the log encountered with Open XL (I had also contacted the cpp team internally and they mentioned that the tolower and toupper are inline functions in C++, and as such the overloading/scoping causes issues) In file included from /omr/ddr/include/ddr/scanner/dwarf/DwarfScanner.hpp:28:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/map:2193:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/functional:526:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__functional/boyer_moore_searcher.h:27:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/vector:325:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__format/formatter_bool.h:20:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__format/formatter_integral.h:35:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/locale:202:
/xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__locale:501:35: error: expected ')'
501 | _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
| ^
/omr/ddr/include/ddr/std/unordered_map.hpp:42:36: note: expanded from macro 'toupper'
42 | #define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
| ^
/xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__locale:501:35: note: to match this '('
/omr/ddr/include/ddr/std/unordered_map.hpp:42:24: note: expanded from macro 'toupper'
42 | #define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
| ^
/xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__locale:501:57: error: expected ';' at end of declaration list
501 | _LIBCPP_HIDE_FROM_ABI char_type toupper(char_type __c) const { return do_toupper(__c); }
| ^
/xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__locale:503:68: error: too many arguments provided to function-like macro invocation
503 | _LIBCPP_HIDE_FROM_ABI const char_type* toupper(char_type* __low, const char_type* __high) const {
| ^
/omr/ddr/include/ddr/std/unordered_map.hpp:42:9: note: macro 'toupper' defined here
42 | #define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
| ^
In file included from omr/ddr/lib/ddr-scanner/dwarf/DwarfScanner.cpp:22:
In file included from omr/ddr/include/ddr/scanner/dwarf/DwarfScanner.hpp:28:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/map:2193:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/functional:526:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__functional/boyer_moore_searcher.h:27:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/vector:325:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__format/formatter_bool.h:20:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__format/formatter_integral.h:35:
In file included from /xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/locale:202:
/xlc210/usr/lpp/IBM/cnw/v2r1/openxl/bin/../include/c++/v1/__locale:596:68: error: too many arguments provided to function-like macro invocation
596 | _LIBCPP_HIDE_FROM_ABI const char_type* tolower(char_type* __low, const char_type* __high) const {
| ^
omr/ddr/include/ddr/std/unordered_map.hpp:43:9: note: macro 'tolower' defined here
43 | #define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
| ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated. |
a8a8919
to
1e0dce1
Compare
Restored back the original code, and added an |
Couple instances where the toupper() and tolower() macros are undef and re-defined that cause problems with the native headers. These may be unnecessary and are removed. Signed-off-by: Gaurav Chaudhari <[email protected]>
1e0dce1
to
08ff877
Compare
@@ -27,13 +27,16 @@ | |||
#if defined(J9ZOS390) | |||
|
|||
#include <ctype.h> | |||
#if !defined(__open_xl__) |
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 util/a2e/headers/ctype.h
should be defining toupper
or tolower
in which case there should be no need to #undef
them anywhere.
A best, this is incomplete as the same pattern also appears in these files:
ddr/include/ddr/std/sstream.hpp
fvtest/omrGtestGlue/omrTest.h
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 am seeing the undefs in (on top of ctype.h)
- ddr/include/ddr/std/sstream.hpp
- fvtest/omrGtestGlue/omrTest.h
- ddr/include/ddr/std/string.hpp
- ddr/include/ddr/std/unordered_map.hpp
- fvtest/omrGtest.cpp
- fvtest/omrGtestGlue
Is not needing the definition coming from the fact that you have noticed these redefinitions are not being used anywhere (like no usages seen in c files?)
What would be the best direction, removing the snippet from ctype.h here, and follow up with just removing the undefs as no-longer having clash with usr/include/xlocale
?
/*
* In ASCII, upper case characters have the bit off ibm@4345
*/
#define toupper(c) (islower(c) ? (c & _XUPPER_ASCII) : c)
#define tolower(c) (isupper(c) ? (c | _XLOWER_ASCII) : c)
Or alternatively, consistently add the open-xl
conditionals across these undef
areas?
I tried removing all the redefinitions and undefs from everywhere, But even with Open XL , I am seeing some errors regarding xtrace options now:
When I had only removed from (Expecting it to certainly fail with the xlc builds if the open-xl build is having issues in the first place too, so trying to resolve this first before cherry picking over to my xlc local build) |
This is a sign that The compiler should be providing an implementation of |
Just adding a small update here, while I am testing changes offline. After seeing that the Tests build was done with XLC Compiler as well, which also failed when removing all the defines. |
Couple instances where the toupper() and tolower() macros are undef and re-defined that cause problems with the native headers. These may be unnecessary and are removed.