2010-05-12 03:42:16 +08:00
|
|
|
// -*- C++ -*-
|
2021-11-18 05:25:01 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2010-05-12 03:42:16 +08:00
|
|
|
//
|
2019-01-19 18:56:40 +08:00
|
|
|
// 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
|
2010-05-12 03:42:16 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#ifndef _LIBCPP_CWCHAR
|
|
|
|
#define _LIBCPP_CWCHAR
|
|
|
|
|
|
|
|
/*
|
|
|
|
cwchar synopsis
|
|
|
|
|
|
|
|
Macros:
|
|
|
|
|
|
|
|
NULL
|
|
|
|
WCHAR_MAX
|
|
|
|
WCHAR_MIN
|
|
|
|
WEOF
|
2010-08-22 08:02:43 +08:00
|
|
|
|
2010-05-12 03:42:16 +08:00
|
|
|
namespace std
|
|
|
|
{
|
|
|
|
|
|
|
|
Types:
|
|
|
|
|
|
|
|
mbstate_t
|
|
|
|
size_t
|
|
|
|
tm
|
|
|
|
wint_t
|
|
|
|
|
|
|
|
int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
|
|
|
|
int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
|
|
|
|
int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
|
|
|
|
int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
|
|
|
|
int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
|
|
|
|
int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
|
|
|
|
int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
|
|
|
|
int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
|
|
|
|
int vwprintf(const wchar_t* restrict format, va_list arg);
|
|
|
|
int vwscanf(const wchar_t* restrict format, va_list arg); // C99
|
|
|
|
int wprintf(const wchar_t* restrict format, ...);
|
|
|
|
int wscanf(const wchar_t* restrict format, ...);
|
|
|
|
wint_t fgetwc(FILE* stream);
|
|
|
|
wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
|
|
|
|
wint_t fputwc(wchar_t c, FILE* stream);
|
|
|
|
int fputws(const wchar_t* restrict s, FILE* restrict stream);
|
|
|
|
int fwide(FILE* stream, int mode);
|
|
|
|
wint_t getwc(FILE* stream);
|
2010-08-22 08:02:43 +08:00
|
|
|
wint_t getwchar();
|
2010-05-12 03:42:16 +08:00
|
|
|
wint_t putwc(wchar_t c, FILE* stream);
|
|
|
|
wint_t putwchar(wchar_t c);
|
|
|
|
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);
|
|
|
|
long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
|
|
|
|
unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
|
|
|
|
unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
|
|
|
|
wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
|
|
|
|
wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
|
|
|
wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
|
|
|
|
wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
|
|
|
int wcscmp(const wchar_t* s1, const wchar_t* s2);
|
|
|
|
int wcscoll(const wchar_t* s1, const wchar_t* s2);
|
|
|
|
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
|
|
|
|
size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
|
|
|
const wchar_t* wcschr(const wchar_t* s, wchar_t c);
|
|
|
|
wchar_t* wcschr( wchar_t* s, wchar_t c);
|
|
|
|
size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
|
|
|
|
size_t wcslen(const wchar_t* s);
|
|
|
|
const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
|
|
|
|
wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
|
|
|
|
const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
|
|
|
|
wchar_t* wcsrchr( wchar_t* s, wchar_t c);
|
|
|
|
size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
|
|
|
|
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
|
|
|
|
wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
|
|
|
|
wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
|
|
|
|
const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
|
|
|
|
wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
|
|
|
|
int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
|
|
|
wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
|
|
|
|
wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
|
|
|
|
wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
|
|
|
|
size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
|
|
|
|
const tm* restrict timeptr);
|
|
|
|
wint_t btowc(int c);
|
|
|
|
int wctob(wint_t c);
|
|
|
|
int mbsinit(const mbstate_t* ps);
|
|
|
|
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
|
2010-08-22 08:02:43 +08:00
|
|
|
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
|
2010-05-12 03:42:16 +08:00
|
|
|
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
|
|
|
|
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
|
2010-08-22 08:02:43 +08:00
|
|
|
mbstate_t* restrict ps);
|
2010-05-12 03:42:16 +08:00
|
|
|
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
|
|
|
mbstate_t* restrict ps);
|
|
|
|
|
|
|
|
} // std
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <__config>
|
|
|
|
#include <cwctype>
|
|
|
|
#include <wchar.h>
|
|
|
|
|
2011-10-18 04:05:10 +08:00
|
|
|
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
2010-05-12 03:42:16 +08:00
|
|
|
#pragma GCC system_header
|
2011-10-18 04:05:10 +08:00
|
|
|
#endif
|
2010-05-12 03:42:16 +08:00
|
|
|
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
|
[libc++] Use the using_if_exists attribute when provided
As discussed on cfe-dev [1], use the using_if_exists Clang attribute when
the compiler supports it. This makes it easier to port libc++ on top of
new platforms that don't fully support the C Standard library.
Previously, libc++ would fail to build when trying to import a missing
declaration in a <cXXXX> header. With the attribute, the declaration will
simply not be imported into namespace std, and hence it won't be available
for libc++ to use. In many cases, the declarations were *not* actually
required for libc++ to work (they were only surfaced for users to use
them as std::XXXX), so not importing them into namespace std is acceptable.
The same thing could be achieved by conscious usage of `#ifdef` along
with platform detection, however that quickly creates a maintenance
problem as libc++ is ported to new platforms. Furthermore, this problem
is exacerbated when mixed with vendor internal-only platforms, which can
lead to difficulties maintaining a downstream fork of the library.
For the time being, we only use the using_if_exists attribute when it
is supported. At some point in the future, we will start removing #ifdef
paths that are unnecessary when the attribute is supported, and folks
who need those #ifdef paths will be required to use a compiler that
supports the attribute.
[1]: http://lists.llvm.org/pipermail/cfe-dev/2020-June/066038.html
Differential Revision: https://reviews.llvm.org/D90257
2021-06-02 22:41:37 +08:00
|
|
|
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::size_t _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::tm _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wint_t _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::FILE _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::fwprintf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::fwscanf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::swprintf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::vfwprintf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::vswprintf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::swscanf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::vfwscanf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::vswscanf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::fgetwc _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::fgetws _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::fputwc _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::fputws _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::fwide _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::getwc _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::putwc _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::ungetwc _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstod _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstof _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstold _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstol _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstoll _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstoul _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstoull _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcscpy _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsncpy _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcscat _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsncat _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcscmp _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcscoll _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsncmp _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsxfrm _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcschr _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcspbrk _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsrchr _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsstr _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wmemchr _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcscspn _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcslen _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsspn _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcstok _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wmemcmp _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wmemcpy _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wmemmove _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wmemset _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsftime _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::btowc _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wctob _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::mbsinit _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::mbrlen _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::mbrtowc _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcrtomb _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::mbsrtowcs _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wcsrtombs _LIBCPP_USING_IF_EXISTS;
|
2010-05-12 03:42:16 +08:00
|
|
|
|
[libc++] Use the using_if_exists attribute when provided
As discussed on cfe-dev [1], use the using_if_exists Clang attribute when
the compiler supports it. This makes it easier to port libc++ on top of
new platforms that don't fully support the C Standard library.
Previously, libc++ would fail to build when trying to import a missing
declaration in a <cXXXX> header. With the attribute, the declaration will
simply not be imported into namespace std, and hence it won't be available
for libc++ to use. In many cases, the declarations were *not* actually
required for libc++ to work (they were only surfaced for users to use
them as std::XXXX), so not importing them into namespace std is acceptable.
The same thing could be achieved by conscious usage of `#ifdef` along
with platform detection, however that quickly creates a maintenance
problem as libc++ is ported to new platforms. Furthermore, this problem
is exacerbated when mixed with vendor internal-only platforms, which can
lead to difficulties maintaining a downstream fork of the library.
For the time being, we only use the using_if_exists attribute when it
is supported. At some point in the future, we will start removing #ifdef
paths that are unnecessary when the attribute is supported, and folks
who need those #ifdef paths will be required to use a compiler that
supports the attribute.
[1]: http://lists.llvm.org/pipermail/cfe-dev/2020-June/066038.html
Differential Revision: https://reviews.llvm.org/D90257
2021-06-02 22:41:37 +08:00
|
|
|
using ::getwchar _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::vwscanf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wscanf _LIBCPP_USING_IF_EXISTS;
|
2015-03-26 22:35:46 +08:00
|
|
|
|
[libc++] Use the using_if_exists attribute when provided
As discussed on cfe-dev [1], use the using_if_exists Clang attribute when
the compiler supports it. This makes it easier to port libc++ on top of
new platforms that don't fully support the C Standard library.
Previously, libc++ would fail to build when trying to import a missing
declaration in a <cXXXX> header. With the attribute, the declaration will
simply not be imported into namespace std, and hence it won't be available
for libc++ to use. In many cases, the declarations were *not* actually
required for libc++ to work (they were only surfaced for users to use
them as std::XXXX), so not importing them into namespace std is acceptable.
The same thing could be achieved by conscious usage of `#ifdef` along
with platform detection, however that quickly creates a maintenance
problem as libc++ is ported to new platforms. Furthermore, this problem
is exacerbated when mixed with vendor internal-only platforms, which can
lead to difficulties maintaining a downstream fork of the library.
For the time being, we only use the using_if_exists attribute when it
is supported. At some point in the future, we will start removing #ifdef
paths that are unnecessary when the attribute is supported, and folks
who need those #ifdef paths will be required to use a compiler that
supports the attribute.
[1]: http://lists.llvm.org/pipermail/cfe-dev/2020-June/066038.html
Differential Revision: https://reviews.llvm.org/D90257
2021-06-02 22:41:37 +08:00
|
|
|
using ::putwchar _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::vwprintf _LIBCPP_USING_IF_EXISTS;
|
|
|
|
using ::wprintf _LIBCPP_USING_IF_EXISTS;
|
2015-03-26 22:35:46 +08:00
|
|
|
|
2010-05-12 03:42:16 +08:00
|
|
|
_LIBCPP_END_NAMESPACE_STD
|
|
|
|
|
2021-04-21 00:03:32 +08:00
|
|
|
#endif // _LIBCPP_CWCHAR
|