[libcxx-commits] [libcxx] e72e785 - [SystemZ][z/OS] Enable POSIX_l functions for z/OS
Abhina Sreeskantharajan via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Nov 10 06:57:19 PST 2020
Author: Muiez Ahmed
Date: 2020-11-10T09:57:11-05:00
New Revision: e72e785d4707f8d02c433bb176ae501751fb3fc9
URL: https://github.com/llvm/llvm-project/commit/e72e785d4707f8d02c433bb176ae501751fb3fc9
DIFF: https://github.com/llvm/llvm-project/commit/e72e785d4707f8d02c433bb176ae501751fb3fc9.diff
LOG: [SystemZ][z/OS] Enable POSIX_l functions for z/OS
The aim of this patch is to enable POSIX _l functions for z/OS. In particular, the functions are provided with libc++ and this patch resorts to the fallback functions. Nonetheless, the functions are being added so the implementation of the ctype<> member functions can call them. The following changes were needed to allow for a successful build when using the libc++ library for z/OS.
Reviewed By: #libc, ldionne
Differential Revision: https://reviews.llvm.org/D90319
Added:
Modified:
libcxx/include/__config
libcxx/include/__locale
libcxx/include/support/ibm/xlocale.h
Removed:
################################################################################
diff --git a/libcxx/include/__config b/libcxx/include/__config
index eeef9c53a9f7..4a1573087aa3 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1219,8 +1219,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# endif
#endif
-#if defined(__BIONIC__) || defined(__CloudABI__) || \
- defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
+#if defined(__BIONIC__) || defined(__CloudABI__) || \
+ defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \
+ defined(__MVS__)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
diff --git a/libcxx/include/__locale b/libcxx/include/__locale
index 125adcf68c84..ed48bfb9ae66 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -22,7 +22,7 @@
#if defined(_LIBCPP_MSVCRT_LIKE)
# include <cstring>
# include <support/win32/locale_win32.h>
-#elif defined(_AIX)
+#elif defined(_AIX) || defined(__MVS__)
# include <support/ibm/xlocale.h>
#elif defined(__ANDROID__)
# include <support/android/locale_bionic.h>
diff --git a/libcxx/include/support/ibm/xlocale.h b/libcxx/include/support/ibm/xlocale.h
index 431bf6268766..fde137cde260 100644
--- a/libcxx/include/support/ibm/xlocale.h
+++ b/libcxx/include/support/ibm/xlocale.h
@@ -11,13 +11,13 @@
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
#include <support/ibm/locale_mgmt_aix.h>
-#if defined(_AIX)
#include "cstdlib"
#ifdef __cplusplus
extern "C" {
#endif
+#if defined(_AIX)
#if !defined(_AIX71)
// AIX 7.1 and higher has these definitions. Definitions and stubs
// are provied here as a temporary workaround on AIX 6.1.
@@ -207,14 +207,20 @@ size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
}
#endif // !defined(_AIX71)
-// strftime_l() is defined by POSIX. However, AIX 7.1 does not have it
-// implemented yet.
+// strftime_l() is defined by POSIX. However, AIX 7.1 and z/OS do not have it
+// implemented yet. z/OS retrieves it from the POSIX fallbacks.
static inline
size_t strftime_l(char *__s, size_t __size, const char *__fmt,
const struct tm *__tm, locale_t locale) {
return __xstrftime(locale, __s, __size, __fmt, __tm);
}
+#elif defined(__MVS__)
+#include <wctype.h>
+// POSIX routines
+#include <support/xlocale/__posix_l_fallback.h>
+#endif // defined(__MVS__)
+
// The following are not POSIX routines. These are quick-and-dirty hacks
// to make things pretend to work
static inline
@@ -266,5 +272,4 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
#ifdef __cplusplus
}
#endif
-#endif // defined(_AIX)
#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
More information about the libcxx-commits
mailing list