Upgrade to 2022-era LLVM LIBCXX

This commit is contained in:
Justine Tunney 2024-05-27 02:12:27 -07:00
parent 2f4ca71f26
commit 8e68384e15
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2078 changed files with 165657 additions and 65010 deletions

View file

@ -1,5 +1,5 @@
// -*- C++ -*-
//===--------------------------- wchar.h ----------------------------------===//
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -7,15 +7,17 @@
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_WCHAR_H
#define _LIBCPP_WCHAR_H
#include "libc/isystem/wchar.h"
#include "third_party/libcxx/__config"
#if defined(__need_wint_t) || defined(__need_mbstate_t)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
# pragma GCC system_header
#endif
#include_next <wchar.h>
#elif !defined(_LIBCPP_WCHAR_H)
#define _LIBCPP_WCHAR_H
/*
wchar.h synopsis
@ -54,8 +56,8 @@ wint_t getwc(FILE* stream);
wint_t getwchar();
wint_t putwc(wchar_t c, FILE* stream);
wint_t putwchar(wchar_t c);
wint_t ungetwc(wint_t c, FILE* stream);d
ouble wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
wint_t ungetwc(wint_t c, FILE* stream);
double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
@ -103,102 +105,88 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
*/
#include <__config>
#include <stddef.h>
#if defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)
# error "The <wchar.h> header is not supported since libc++ has been configured with LIBCXX_ENABLE_WIDE_CHARACTERS disabled"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
// We define this here to support older versions of glibc <wchar.h> that do
// not define this for clang.
#ifdef __cplusplus
#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
#endif
// #include_next <wchar.h>
# if __has_include_next(<wchar.h>)
# include_next <wchar.h>
# else
# include <__mbstate_t.h> // make sure we have mbstate_t regardless of the existence of <wchar.h>
# endif
// Determine whether we have const-correct overloads for wcschr and friends.
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
#define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
#elif defined(__GLIBC_PREREQ)
#if __GLIBC_PREREQ(2, 10)
#define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
#endif
# if __GLIBC_PREREQ(2, 10)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
# endif
#elif defined(_LIBCPP_MSVCRT)
#if defined(_CRT_CONST_CORRECT_OVERLOADS)
#define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
#endif
# if defined(_CRT_CONST_CORRECT_OVERLOADS)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
# endif
#endif
#if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && \
defined(_LIBCPP_PREFERRED_OVERLOAD)
#if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
extern "C++" {
inline _LIBCPP_INLINE_VISIBILITY wchar_t* __libcpp_wcschr(const wchar_t* __s,
wchar_t __c) {
return (wchar_t*)wcschr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
wcschr(const wchar_t* __s, wchar_t __c) {
return __libcpp_wcschr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD wchar_t*
wcschr(wchar_t* __s, wchar_t __c) {
return __libcpp_wcschr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY
wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return __libcpp_wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t*
__libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
return (wchar_t*)wcspbrk(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcspbrk(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD wchar_t*
wcspbrk(wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcspbrk(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY
wchar_t* __libcpp_wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcspbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcspbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* __libcpp_wcsrchr(const wchar_t* __s,
wchar_t __c) {
return (wchar_t*)wcsrchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
wcsrchr(const wchar_t* __s, wchar_t __c) {
return __libcpp_wcsrchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD wchar_t*
wcsrchr(wchar_t* __s, wchar_t __c) {
return __libcpp_wcsrchr(__s, __c);
}
inline _LIBCPP_INLINE_VISIBILITY
wchar_t* __libcpp_wcsrchr(const wchar_t* __s, wchar_t __c) {return (wchar_t*)wcsrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return __libcpp_wcsrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* __libcpp_wcsstr(const wchar_t* __s1,
const wchar_t* __s2) {
return (wchar_t*)wcsstr(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
wcsstr(const wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcsstr(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD wchar_t*
wcsstr(wchar_t* __s1, const wchar_t* __s2) {
return __libcpp_wcsstr(__s1, __s2);
}
inline _LIBCPP_INLINE_VISIBILITY
wchar_t* __libcpp_wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return (wchar_t*)wcsstr(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return __libcpp_wcsstr(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t*
__libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
return (wchar_t*)wmemchr(__s, __c, __n);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD const wchar_t*
wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {
return __libcpp_wmemchr(__s, __c, __n);
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD wchar_t*
wmemchr(wchar_t* __s, wchar_t __c, size_t __n) {
return __libcpp_wmemchr(__s, __c, __n);
}
inline _LIBCPP_INLINE_VISIBILITY
wchar_t* __libcpp_wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return (wchar_t*)wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return __libcpp_wmemchr(__s, __c, __n);}
}
#endif
#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE)
#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))
extern "C" {
size_t mbsnrtowcs(wchar_t* __restrict dst, const char** __restrict src,
size_t nmc, size_t len, mbstate_t* __restrict ps);
size_t wcsnrtombs(char* __restrict dst, const wchar_t** __restrict src,
size_t nwc, size_t len, mbstate_t* __restrict ps);
} // extern "C++"
#endif // __cplusplus && _LIBCPP_MSVCRT
size_t mbsnrtowcs(wchar_t *__restrict __dst, const char **__restrict __src,
size_t __nmc, size_t __len, mbstate_t *__restrict __ps);
size_t wcsnrtombs(char *__restrict __dst, const wchar_t **__restrict __src,
size_t __nwc, size_t __len, mbstate_t *__restrict __ps);
} // extern "C"
#endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)
#endif // _LIBCPP_WCHAR_H