[libcxx][AIX] Remove locale fallbacks for old OS levels

These routines were add years ago during initial porting attempts to AIX and are mostly build hacks for routines which we're missing at the time, but are available now on recent AIX OS levels.

Thus builds on modern AIX OS levels no longer need these and they cause problems if you try to build the library with a generic triple (i.e. powerpc-ibm-aix) as we'll pull them in and encounter duplicate definitions from the OS.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D110183
This commit is contained in:
David Tenty 2021-09-07 15:57:38 -04:00
parent 5f187f0afa
commit 7a320b279d
3 changed files with 1 additions and 287 deletions

View File

@ -255,7 +255,6 @@ set(files
__support/fuchsia/xlocale.h
__support/ibm/gettod_zos.h
__support/ibm/limits.h
__support/ibm/locale_mgmt_aix.h
__support/ibm/locale_mgmt_zos.h
__support/ibm/nanosleep.h
__support/ibm/support.h

View File

@ -1,84 +0,0 @@
// -*- C++ -*-
//===-----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H
#define _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H
#if defined(_AIX)
#include "cstdlib"
#ifdef __cplusplus
extern "C" {
#endif
#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.
#define LC_COLLATE_MASK 1
#define LC_CTYPE_MASK 2
#define LC_MESSAGES_MASK 4
#define LC_MONETARY_MASK 8
#define LC_NUMERIC_MASK 16
#define LC_TIME_MASK 32
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \
LC_MESSAGES_MASK | LC_MONETARY_MASK |\
LC_NUMERIC_MASK | LC_TIME_MASK)
typedef void* locale_t;
// The following are stubs. They are not supported on AIX 6.1.
static inline
locale_t newlocale(int category_mask, const char *locale, locale_t base)
{
_LC_locale_t *newloc, *loc;
if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL)
{
errno = EINVAL;
return (locale_t)0;
}
if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL)
{
errno = ENOMEM;
return (locale_t)0;
}
if (!base)
base = (_LC_locale_t *)__xopen_locale("C");
memcpy(newloc, base, sizeof (_LC_locale_t));
if (category_mask & LC_COLLATE_MASK)
newloc->lc_collate = loc->lc_collate;
if (category_mask & LC_CTYPE_MASK)
newloc->lc_ctype = loc->lc_ctype;
//if (category_mask & LC_MESSAGES_MASK)
// newloc->lc_messages = loc->lc_messages;
if (category_mask & LC_MONETARY_MASK)
newloc->lc_monetary = loc->lc_monetary;
if (category_mask & LC_TIME_MASK)
newloc->lc_time = loc->lc_time;
if (category_mask & LC_NUMERIC_MASK)
newloc->lc_numeric = loc->lc_numeric;
return (locale_t)newloc;
}
static inline
void freelocale(locale_t locobj)
{
free(locobj);
}
static inline
locale_t uselocale(locale_t newloc)
{
return (locale_t)0;
}
#endif // !defined(_AIX71)
#ifdef __cplusplus
}
#endif
#endif // defined(_AIX)
#endif // _LIBCPP_SUPPORT_IBM_LOCALE_MGMT_AIX_H

View File

@ -10,7 +10,6 @@
#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
#include <__support/ibm/locale_mgmt_aix.h>
#include <__support/ibm/locale_mgmt_zos.h>
#include <stdarg.h>
@ -20,207 +19,7 @@
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.
static inline
int isalnum_l(int c, locale_t locale)
{
return __xisalnum(locale, c);
}
static inline
int isalpha_l(int c, locale_t locale)
{
return __xisalpha(locale, c);
}
static inline
int isblank_l(int c, locale_t locale)
{
return __xisblank(locale, c);
}
static inline
int iscntrl_l(int c, locale_t locale)
{
return __xiscntrl(locale, c);
}
static inline
int isdigit_l(int c, locale_t locale)
{
return __xisdigit(locale, c);
}
static inline
int isgraph_l(int c, locale_t locale)
{
return __xisgraph(locale, c);
}
static inline
int islower_l(int c, locale_t locale)
{
return __xislower(locale, c);
}
static inline
int isprint_l(int c, locale_t locale)
{
return __xisprint(locale, c);
}
static inline
int ispunct_l(int c, locale_t locale)
{
return __xispunct(locale, c);
}
static inline
int isspace_l(int c, locale_t locale)
{
return __xisspace(locale, c);
}
static inline
int isupper_l(int c, locale_t locale)
{
return __xisupper(locale, c);
}
static inline
int isxdigit_l(int c, locale_t locale)
{
return __xisxdigit(locale, c);
}
static inline
int iswalnum_l(wchar_t wc, locale_t locale)
{
return __xiswalnum(locale, wc);
}
static inline
int iswalpha_l(wchar_t wc, locale_t locale)
{
return __xiswalpha(locale, wc);
}
static inline
int iswblank_l(wchar_t wc, locale_t locale)
{
return __xiswblank(locale, wc);
}
static inline
int iswcntrl_l(wchar_t wc, locale_t locale)
{
return __xiswcntrl(locale, wc);
}
static inline
int iswdigit_l(wchar_t wc, locale_t locale)
{
return __xiswdigit(locale, wc);
}
static inline
int iswgraph_l(wchar_t wc, locale_t locale)
{
return __xiswgraph(locale, wc);
}
static inline
int iswlower_l(wchar_t wc, locale_t locale)
{
return __xiswlower(locale, wc);
}
static inline
int iswprint_l(wchar_t wc, locale_t locale)
{
return __xiswprint(locale, wc);
}
static inline
int iswpunct_l(wchar_t wc, locale_t locale)
{
return __xiswpunct(locale, wc);
}
static inline
int iswspace_l(wchar_t wc, locale_t locale)
{
return __xiswspace(locale, wc);
}
static inline
int iswupper_l(wchar_t wc, locale_t locale)
{
return __xiswupper(locale, wc);
}
static inline
int iswxdigit_l(wchar_t wc, locale_t locale)
{
return __xiswxdigit(locale, wc);
}
static inline
int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)
{
return __xiswctype(locale, wc, desc);
}
static inline
int toupper_l(int c, locale_t locale)
{
return __xtoupper(locale, c);
}
static inline
int tolower_l(int c, locale_t locale)
{
return __xtolower(locale, c);
}
static inline
wint_t towupper_l(wint_t wc, locale_t locale)
{
return __xtowupper(locale, wc);
}
static inline
wint_t towlower_l(wint_t wc, locale_t locale)
{
return __xtowlower(locale, wc);
}
static inline
int strcoll_l(const char *__s1, const char *__s2, locale_t locale)
{
return __xstrcoll(locale, __s1, __s2);
}
static inline
int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t locale)
{
return __xwcscoll(locale, __s1, __s2);
}
static inline
size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t locale)
{
return __xstrxfrm(locale, __s1, __s2, __n);
}
static inline
size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
locale_t locale)
{
return __xwcsxfrm(locale, __ws1, __ws2, __n);
}
#endif // !defined(_AIX71)
// 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.
#if !defined(_AIX72)
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);
}
#endif
#elif defined(__MVS__)
#if defined(__MVS__)
#include <wctype.h>
// POSIX routines
#include <__support/xlocale/__posix_l_fallback.h>