The aim of this patch is to localize the string literals in order to carry out translations based on the char-mode. This is a continuation to add ASCII/EBCDIC support for z/OS. This could also be the ground work for enabling internationalization of the runtime messages.
Details
Diff Detail
Event Timeline
LGTM with minor suggestions.
libcxxabi/src/abort_message.cpp | ||
---|---|---|
8 | I might be wrong but I think the use defined headers should be included after the system ones. Can you keep it the original order? | |
libcxxabi/src/abort_message.h | ||
12 | This will make consistent by including this header as user define one and move it down after `cxxabi.h as being done in other locations. | |
libcxxabi/src/cxa_guard_impl.h | ||
48 | same as above | |
libcxxabi/src/cxa_virtual.cpp | ||
9 | same as above |
libcxxabi/src/abort_message.cpp | ||
---|---|---|
8 | The "abort_message.h" header should be included before the others in this case because we refer to bimodal functions (eg __fprintf_a). In particular, abort_message.h includes error_message.h which includes the Bimodal header. This should be included before the other headers (such as stdio.h) to avoid an undeclared identifier error. |
libcxxabi/src/abort_message.cpp | ||
---|---|---|
35–58 | I suggest making a macro to wrap the function fprintf. That would simplify the this code. For example: #ifdef __MVS__ #define fprintf(...) \ if (__isASCII()) __fprintf_a(__VA_ARGS__); \ else __fprintf_e(__VA_ARGS__) #endif Do the same for vfprintf() and we can remove the duplication in this code. Same for the snprintf system_error.cpp. Just confirm fprintf, etc aren't macros already on MVS. |
The CI is failing with the following warning (shown as an error):
/home/libcxx-builder/.buildkite-agent/builds/63ef6a49a323-1/llvm-project/libcxx-ci/libcxx/src/system_error.cpp:134:44: error: format string is not a string literal [-Werror,-Wformat-nonliteral] snprintf(buffer, strerror_buff_size, getRuntimeErrorString(RM_UNKNOWN_ERROR), ev);
Any suggestions on getting passed this warning? It should be noted that getRuntimeErrorString(RM_UNKNOWN_ERROR) returns "Unknown error %d", which includes a format specifier so we can't make the call with "%s" as a string literal.
This will make consistent by including this header as user define one and move it down after `cxxabi.h as being done in other locations.