[libc++] Remove support for CloudABI, which has been abandoned

Based on https://github.com/NuxiNL/cloudlibc, it appears that the CloudABI
project has been abandoned. This patch removes a bunch of CloudABI specific
logic that had been added to support that platform.

Note that some knobs like LIBCXX_ENABLE_STDIN and LIBCXX_ENABLE_STDOUT
coud be useful in their own right, however those are currently broken.
If we want to re-add such knobs in the future, we can do it like we've
done it for localization & friends so that we can officially support
that configuration.

Differential Revision: https://reviews.llvm.org/D108637
This commit is contained in:
Louis Dionne 2021-08-24 11:40:05 -04:00
parent 92c1fd19ab
commit 87dd51983c
35 changed files with 4 additions and 273 deletions

View File

@ -263,11 +263,7 @@ set(LIBCXX_GCC_TOOLCHAIN "" CACHE STRING "Use alternate GCC toolchain.")
# Feature options -------------------------------------------------------------
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
option(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE "Build libc++ with support for the global filesystem namespace." ON)
option(LIBCXX_ENABLE_STDIN "Build libc++ with support for stdin/std::cin." ON)
option(LIBCXX_ENABLE_STDOUT "Build libc++ with support for stdout/std::cout." ON)
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
option(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS "Build libc++ with support for thread-unsafe C functions" ON)
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
"Build libc++ with support for a monotonic clock.
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
@ -868,12 +864,8 @@ config_define_if(LIBCXX_ABI_UNSTABLE _LIBCPP_ABI_UNSTABLE)
config_define_if(LIBCXX_ABI_FORCE_ITANIUM _LIBCPP_ABI_FORCE_ITANIUM)
config_define_if(LIBCXX_ABI_FORCE_MICROSOFT _LIBCPP_ABI_FORCE_MICROSOFT)
config_define_if(LIBCXX_HIDE_FROM_ABI_PER_TU_BY_DEFAULT _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT)
config_define_if_not(LIBCXX_ENABLE_GLOBAL_FILESYSTEM_NAMESPACE _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE)
config_define_if_not(LIBCXX_ENABLE_STDIN _LIBCPP_HAS_NO_STDIN)
config_define_if_not(LIBCXX_ENABLE_STDOUT _LIBCPP_HAS_NO_STDOUT)
config_define_if_not(LIBCXX_ENABLE_THREADS _LIBCPP_HAS_NO_THREADS)
config_define_if_not(LIBCXX_ENABLE_MONOTONIC_CLOCK _LIBCPP_HAS_NO_MONOTONIC_CLOCK)
config_define_if_not(LIBCXX_ENABLE_THREAD_UNSAFE_C_FUNCTIONS _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS)
if (NOT LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION STREQUAL "default")
config_define("${LIBCXX_TYPEINFO_COMPARISON_IMPLEMENTATION}" _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
endif()

View File

@ -65,12 +65,8 @@ configuration all together. An example "__config" header generated when
#ifndef _LIBCPP_CONFIG_SITE
#define _LIBCPP_CONFIG_SITE
/* #undef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE */
/* #undef _LIBCPP_HAS_NO_STDIN */
/* #undef _LIBCPP_HAS_NO_STDOUT */
#define _LIBCPP_HAS_NO_THREADS
/* #undef _LIBCPP_HAS_NO_MONOTONIC_CLOCK */
/* #undef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS */
#endif
// -*- C++ -*-

View File

@ -318,7 +318,7 @@
# endif
#endif // __sun__
#if defined(__OpenBSD__) || defined(__CloudABI__)
#if defined(__OpenBSD__)
// Certain architectures provide arc4random(). Prefer using
// arc4random() over /dev/{u,}random to make it possible to obtain
// random data even when using sandboxing mechanisms such as chroots,
@ -935,7 +935,7 @@ typedef unsigned int char32_t;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
defined(__sun__) || defined(__NetBSD__)
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
@ -1139,7 +1139,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
defined(__linux__) || \
defined(__GNU__) || \
defined(__APPLE__) || \
defined(__CloudABI__) || \
defined(__sun__) || \
defined(__MVS__) || \
defined(_AIX) || \
@ -1213,21 +1212,6 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
#endif
// Systems that use capability-based security (FreeBSD with Capsicum,
// Nuxi CloudABI) may only provide local filesystem access (using *at()).
// Functions like open(), rename(), unlink() and stat() should not be
// used, as they attempt to access the global filesystem namespace.
#ifdef __CloudABI__
#define _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
#endif
// CloudABI is intended for running networked services. Processes do not
// have standard input and output channels.
#ifdef __CloudABI__
#define _LIBCPP_HAS_NO_STDIN
#define _LIBCPP_HAS_NO_STDOUT
#endif
// Some systems do not provide gets() in their C library, for security reasons.
#if defined(_LIBCPP_MSVCRT) || \
(defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || \
@ -1235,18 +1219,12 @@ extern "C" _LIBCPP_FUNC_VIS void __sanitizer_annotate_contiguous_container(
# define _LIBCPP_C_HAS_NO_GETS
#endif
#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \
#if defined(__BIONIC__) || defined(__NuttX__) || \
defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \
defined(__MVS__) || defined(__OpenBSD__)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
// Thread-unsafe functions such as strtok() and localtime()
// are not available.
#ifdef __CloudABI__
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#endif
#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
# define _LIBCPP_HAS_C_ATOMIC_IMP
#elif defined(_LIBCPP_COMPILER_GCC)

View File

@ -14,12 +14,8 @@
#cmakedefine _LIBCPP_ABI_FORCE_ITANIUM
#cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT
#cmakedefine _LIBCPP_HIDE_FROM_ABI_PER_TU_BY_DEFAULT
#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
#cmakedefine _LIBCPP_HAS_NO_STDIN
#cmakedefine _LIBCPP_HAS_NO_STDOUT
#cmakedefine _LIBCPP_HAS_NO_THREADS
#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
#cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#cmakedefine _LIBCPP_HAS_MUSL_LIBC
#cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL

View File

@ -44,9 +44,7 @@ lconv* localeconv();
_LIBCPP_BEGIN_NAMESPACE_STD
using ::lconv _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
using ::setlocale _LIBCPP_USING_IF_EXISTS;
#endif
using ::localeconv _LIBCPP_USING_IF_EXISTS;
_LIBCPP_END_NAMESPACE_STD

View File

@ -145,30 +145,24 @@ using ::feof _LIBCPP_USING_IF_EXISTS;
using ::ferror _LIBCPP_USING_IF_EXISTS;
using ::perror _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
using ::fopen _LIBCPP_USING_IF_EXISTS;
using ::freopen _LIBCPP_USING_IF_EXISTS;
using ::remove _LIBCPP_USING_IF_EXISTS;
using ::rename _LIBCPP_USING_IF_EXISTS;
using ::tmpfile _LIBCPP_USING_IF_EXISTS;
using ::tmpnam _LIBCPP_USING_IF_EXISTS;
#endif
#ifndef _LIBCPP_HAS_NO_STDIN
using ::getchar _LIBCPP_USING_IF_EXISTS;
#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS)
using ::gets _LIBCPP_USING_IF_EXISTS;
#endif
using ::scanf _LIBCPP_USING_IF_EXISTS;
using ::vscanf _LIBCPP_USING_IF_EXISTS;
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
using ::printf _LIBCPP_USING_IF_EXISTS;
using ::putchar _LIBCPP_USING_IF_EXISTS;
using ::puts _LIBCPP_USING_IF_EXISTS;
using ::vprintf _LIBCPP_USING_IF_EXISTS;
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@ -84,9 +84,7 @@ using ::strpbrk _LIBCPP_USING_IF_EXISTS;
using ::strrchr _LIBCPP_USING_IF_EXISTS;
using ::strspn _LIBCPP_USING_IF_EXISTS;
using ::strstr _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
using ::strtok _LIBCPP_USING_IF_EXISTS;
#endif
using ::memset _LIBCPP_USING_IF_EXISTS;
using ::strerror _LIBCPP_USING_IF_EXISTS;
using ::strlen _LIBCPP_USING_IF_EXISTS;

View File

@ -79,12 +79,10 @@ using ::clock _LIBCPP_USING_IF_EXISTS;
using ::difftime _LIBCPP_USING_IF_EXISTS;
using ::mktime _LIBCPP_USING_IF_EXISTS;
using ::time _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
using ::asctime _LIBCPP_USING_IF_EXISTS;
using ::ctime _LIBCPP_USING_IF_EXISTS;
using ::gmtime _LIBCPP_USING_IF_EXISTS;
using ::localtime _LIBCPP_USING_IF_EXISTS;
#endif
using ::strftime _LIBCPP_USING_IF_EXISTS;
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) && !defined(_LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED)
using ::timespec_get _LIBCPP_USING_IF_EXISTS;

View File

@ -175,17 +175,13 @@ using ::wcrtomb _LIBCPP_USING_IF_EXISTS;
using ::mbsrtowcs _LIBCPP_USING_IF_EXISTS;
using ::wcsrtombs _LIBCPP_USING_IF_EXISTS;
#ifndef _LIBCPP_HAS_NO_STDIN
using ::getwchar _LIBCPP_USING_IF_EXISTS;
using ::vwscanf _LIBCPP_USING_IF_EXISTS;
using ::wscanf _LIBCPP_USING_IF_EXISTS;
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
using ::putwchar _LIBCPP_USING_IF_EXISTS;
using ::vwprintf _LIBCPP_USING_IF_EXISTS;
using ::wprintf _LIBCPP_USING_IF_EXISTS;
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@ -230,7 +230,6 @@ public:
// 27.9.1.4 Members:
_LIBCPP_INLINE_VISIBILITY
bool is_open() const;
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
basic_filebuf* open(const char* __s, ios_base::openmode __mode);
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
basic_filebuf* open(const wchar_t* __s, ios_base::openmode __mode);
@ -246,7 +245,6 @@ public:
#endif
_LIBCPP_INLINE_VISIBILITY
basic_filebuf* __open(int __fd, ios_base::openmode __mode);
#endif
basic_filebuf* close();
_LIBCPP_INLINE_VISIBILITY
@ -542,7 +540,6 @@ const char* basic_filebuf<_CharT, _Traits>::__make_mdstring(
_LIBCPP_UNREACHABLE();
}
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>*
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
@ -685,7 +682,6 @@ basic_filebuf<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
{
return open(__s.c_str(), __mode);
}
#endif
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>*
@ -1141,7 +1137,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_ifstream();
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
_LIBCPP_INLINE_VISIBILITY
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
@ -1155,7 +1150,6 @@ public:
explicit basic_ifstream(const filesystem::path& __p, ios_base::openmode __mode = ios_base::in)
: basic_ifstream(__p.c_str(), __mode) {}
#endif // _LIBCPP_STD_VER >= 17
#endif
_LIBCPP_INLINE_VISIBILITY
basic_ifstream(basic_ifstream&& __rhs);
_LIBCPP_INLINE_VISIBILITY
@ -1167,7 +1161,6 @@ public:
basic_filebuf<char_type, traits_type>* rdbuf() const;
_LIBCPP_INLINE_VISIBILITY
bool is_open() const;
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
void open(const char* __s, ios_base::openmode __mode = ios_base::in);
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in);
@ -1183,7 +1176,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
void __open(int __fd, ios_base::openmode __mode);
#endif
_LIBCPP_INLINE_VISIBILITY
void close();
@ -1198,7 +1190,6 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream()
{
}
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
template <class _CharT, class _Traits>
inline
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
@ -1227,7 +1218,6 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
template <class _CharT, class _Traits>
inline
@ -1281,7 +1271,6 @@ basic_ifstream<_CharT, _Traits>::is_open() const
return __sb_.is_open();
}
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
template <class _CharT, class _Traits>
void
basic_ifstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
@ -1323,7 +1312,6 @@ void basic_ifstream<_CharT, _Traits>::__open(int __fd,
else
this->setstate(ios_base::failbit);
}
#endif
template <class _CharT, class _Traits>
inline
@ -1375,7 +1363,6 @@ public:
basic_filebuf<char_type, traits_type>* rdbuf() const;
_LIBCPP_INLINE_VISIBILITY
bool is_open() const;
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
void open(const char* __s, ios_base::openmode __mode = ios_base::out);
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::out);
@ -1390,7 +1377,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
void __open(int __fd, ios_base::openmode __mode);
#endif
_LIBCPP_INLINE_VISIBILITY
void close();
@ -1405,7 +1391,6 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream()
{
}
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
template <class _CharT, class _Traits>
inline
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
@ -1434,7 +1419,6 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
template <class _CharT, class _Traits>
inline
@ -1488,7 +1472,6 @@ basic_ofstream<_CharT, _Traits>::is_open() const
return __sb_.is_open();
}
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
template <class _CharT, class _Traits>
void
basic_ofstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
@ -1530,7 +1513,6 @@ void basic_ofstream<_CharT, _Traits>::__open(int __fd,
else
this->setstate(ios_base::failbit);
}
#endif
template <class _CharT, class _Traits>
inline
@ -1556,7 +1538,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_fstream();
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
_LIBCPP_INLINE_VISIBILITY
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
@ -1572,7 +1553,6 @@ public:
: basic_fstream(__p.c_str(), __mode) {}
#endif // _LIBCPP_STD_VER >= 17
#endif
_LIBCPP_INLINE_VISIBILITY
basic_fstream(basic_fstream&& __rhs);
@ -1586,7 +1566,6 @@ public:
basic_filebuf<char_type, traits_type>* rdbuf() const;
_LIBCPP_INLINE_VISIBILITY
bool is_open() const;
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
void open(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
#ifdef _LIBCPP_HAS_OPEN_WITH_WCHAR
void open(const wchar_t* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
@ -1599,7 +1578,6 @@ public:
{ return open(__p.c_str(), __mode); }
#endif // _LIBCPP_STD_VER >= 17
#endif
_LIBCPP_INLINE_VISIBILITY
void close();
@ -1614,7 +1592,6 @@ basic_fstream<_CharT, _Traits>::basic_fstream()
{
}
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
template <class _CharT, class _Traits>
inline
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
@ -1643,7 +1620,6 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
if (__sb_.open(__s, __mode) == nullptr)
this->setstate(ios_base::failbit);
}
#endif
template <class _CharT, class _Traits>
inline
@ -1697,7 +1673,6 @@ basic_fstream<_CharT, _Traits>::is_open() const
return __sb_.is_open();
}
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
template <class _CharT, class _Traits>
void
basic_fstream<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
@ -1729,7 +1704,6 @@ basic_fstream<_CharT, _Traits>::open(const string& __s, ios_base::openmode __mod
else
this->setstate(ios_base::failbit);
}
#endif
template <class _CharT, class _Traits>
inline

View File

@ -45,14 +45,10 @@ extern wostream wclog;
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_STDIN
extern _LIBCPP_FUNC_VIS istream cin;
extern _LIBCPP_FUNC_VIS wistream wcin;
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
extern _LIBCPP_FUNC_VIS ostream cout;
extern _LIBCPP_FUNC_VIS wostream wcout;
#endif
extern _LIBCPP_FUNC_VIS ostream cerr;
extern _LIBCPP_FUNC_VIS wostream wcerr;
extern _LIBCPP_FUNC_VIS ostream clog;

View File

@ -230,7 +230,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
# define _LIBCPP_GET_C_LOCALE 0
#elif defined(__CloudABI__) || defined(__NetBSD__)
#elif defined(__NetBSD__)
# define _LIBCPP_GET_C_LOCALE LC_C_LOCALE
#else
# define _LIBCPP_GET_C_LOCALE __cloc()

View File

@ -17,7 +17,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_STDIN
_ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A")
@ -32,9 +31,7 @@ __asm__("?wcin@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_istream@_WU?$char_tr
;
_ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin[sizeof(__stdinbuf <wchar_t>)];
static mbstate_t mb_wcin;
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@DU?$char_traits@D@" _LIBCPP_ABI_NAMESPACE_STR "@std@@@12@A")
@ -49,7 +46,6 @@ __asm__("?wcout@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_t
;
_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
static mbstate_t mb_wcout;
#endif
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)]
#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
@ -107,39 +103,29 @@ DoIOSInit::DoIOSInit()
{
force_locale_initialization();
#ifndef _LIBCPP_HAS_NO_STDIN
istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, &mb_cin));
wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, &mb_wcin));
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, &mb_cout));
wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, &mb_wcout));
#endif
ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, &mb_cerr));
::new(clog) ostream(cerr_ptr->rdbuf());
wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, &mb_wcerr));
::new(wclog) wostream(wcerr_ptr->rdbuf());
#if !defined(_LIBCPP_HAS_NO_STDIN) && !defined(_LIBCPP_HAS_NO_STDOUT)
cin_ptr->tie(cout_ptr);
wcin_ptr->tie(wcout_ptr);
#endif
_VSTD::unitbuf(*cerr_ptr);
_VSTD::unitbuf(*wcerr_ptr);
#ifndef _LIBCPP_HAS_NO_STDOUT
cerr_ptr->tie(cout_ptr);
wcerr_ptr->tie(wcout_ptr);
#endif
}
DoIOSInit::~DoIOSInit()
{
#ifndef _LIBCPP_HAS_NO_STDOUT
ostream* cout_ptr = reinterpret_cast<ostream*>(cout);
wostream* wcout_ptr = reinterpret_cast<wostream*>(wcout);
cout_ptr->flush();
wcout_ptr->flush();
#endif
ostream* clog_ptr = reinterpret_cast<ostream*>(clog);
wostream* wclog_ptr = reinterpret_cast<wostream*>(wclog);

View File

@ -1,18 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// REQUIRES: libcpp-has-no-global-filesystem-namespace
#include <cstdio>
int main(int, char**) {
// fopen is not available on systems without a global filesystem namespace.
std::fopen("", "");
return 0;
}

View File

@ -1,18 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// REQUIRES: libcpp-has-no-global-filesystem-namespace
#include <cstdio>
int main(int, char**) {
// rename is not available on systems without a global filesystem namespace.
std::rename("", "");
return 0;
}

View File

@ -1,19 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// REQUIRES: libcpp-has-no-thread-unsafe-c-functions
#include <ctime>
int main(int, char**) {
// asctime is not thread-safe.
std::time_t t = 0;
std::asctime(&t);
return 0;
}

View File

@ -1,19 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// REQUIRES: libcpp-has-no-thread-unsafe-c-functions
#include <ctime>
int main(int, char**) {
// ctime is not thread-safe.
std::time_t t = 0;
std::ctime(&t);
return 0;
}

View File

@ -1,19 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// REQUIRES: libcpp-has-no-thread-unsafe-c-functions
#include <ctime>
int main(int, char**) {
// gmtime is not thread-safe.
std::time_t t = 0;
std::gmtime(&t);
return 0;
}

View File

@ -1,19 +0,0 @@
//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
// REQUIRES: libcpp-has-no-thread-unsafe-c-functions
#include <ctime>
int main(int, char**) {
// localtime is not thread-safe.
std::time_t t = 0;
std::localtime(&t);
return 0;
}

View File

@ -47,9 +47,7 @@ int main(int, char**)
ASSERT_SAME_TYPE(size_t, decltype(strspn(cpc, cpc)));
ASSERT_SAME_TYPE(char*, decltype(strstr(cp, cpc)));
ASSERT_SAME_TYPE(const char*, decltype(strstr(cpc, cpc)));
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
ASSERT_SAME_TYPE(char*, decltype(strtok(cp, cpc)));
#endif
ASSERT_SAME_TYPE(void*, decltype(memset(vp, 0, s)));
ASSERT_SAME_TYPE(char*, decltype(strerror(0)));
ASSERT_SAME_TYPE(size_t, decltype(strlen(cpc)));

View File

@ -115,18 +115,12 @@ int main(int, char**)
ASSERT_SAME_TYPE(size_t, decltype(wcrtomb(ns, L' ', &mb)));
ASSERT_SAME_TYPE(size_t, decltype(mbsrtowcs(ws, (const char**)0, s, &mb)));
ASSERT_SAME_TYPE(size_t, decltype(wcsrtombs(ns, (const wchar_t**)0, s, &mb)));
#ifndef _LIBCPP_HAS_NO_STDIN
ASSERT_SAME_TYPE(wint_t, decltype(getwchar()));
ASSERT_SAME_TYPE(int, decltype(vwscanf(L"", va)));
ASSERT_SAME_TYPE(int, decltype(wscanf(L"")));
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
ASSERT_SAME_TYPE(wint_t, decltype(putwchar(L' ')));
ASSERT_SAME_TYPE(int, decltype(vwprintf(L"", va)));
ASSERT_SAME_TYPE(int, decltype(wprintf(L"")));
#endif
return 0;
}

View File

@ -136,16 +136,13 @@ int main(int, char**)
static_assert((std::is_same<decltype(std::ferror(fp)), int>::value), "");
static_assert((std::is_same<decltype(std::perror("")), void>::value), "");
#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
static_assert((std::is_same<decltype(std::fopen("", "")), std::FILE*>::value), "");
static_assert((std::is_same<decltype(std::freopen("", "", fp)), std::FILE*>::value), "");
static_assert((std::is_same<decltype(std::remove("")), int>::value), "");
static_assert((std::is_same<decltype(std::rename("","")), int>::value), "");
static_assert((std::is_same<decltype(std::tmpfile()), std::FILE*>::value), "");
static_assert((std::is_same<decltype(std::tmpnam(cp)), char*>::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_STDIN
static_assert((std::is_same<decltype(std::getchar()), int>::value), "");
#if TEST_STD_VER <= 11
# pragma GCC diagnostic push
@ -155,14 +152,11 @@ int main(int, char**)
#endif
static_assert((std::is_same<decltype(std::scanf(" ")), int>::value), "");
static_assert((std::is_same<decltype(std::vscanf(" ",va)), int>::value), "");
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
static_assert((std::is_same<decltype(std::printf(" ")), int>::value), "");
static_assert((std::is_same<decltype(std::putchar(0)), int>::value), "");
static_assert((std::is_same<decltype(std::puts("")), int>::value), "");
static_assert((std::is_same<decltype(std::vprintf(" ",va)), int>::value), "");
#endif
return 0;
}

View File

@ -1,2 +0,0 @@
if 'libcpp-has-no-global-filesystem-namespace' in config.available_features:
config.unsupported = True

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: libcpp-has-no-stdin, libcpp-has-no-stdout
// Make sure that the iostreams are initialized before everything else.
// This has been an issue when statically linking libc++ in some contexts.
// See https://llvm.org/PR28954 for details.

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-stdin
// <iostream>
// istream cin;

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-stdout
// <iostream>
// istream cout;

View File

@ -6,8 +6,6 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-stdin
// <iostream>
// istream wcin;

View File

@ -6,7 +6,6 @@
//
//===----------------------------------------------------------------------===//
// XFAIL: libcpp-has-no-stdout
// XFAIL: LIBCXX-WINDOWS-FIXME
// <iostream>

View File

@ -41,12 +41,10 @@ int main(int, char**)
static_assert((std::is_same<decltype(std::difftime(t,t)), double>::value), "");
static_assert((std::is_same<decltype(std::mktime(&tm)), std::time_t>::value), "");
static_assert((std::is_same<decltype(std::time(&t)), std::time_t>::value), "");
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
static_assert((std::is_same<decltype(std::asctime(&tm)), char*>::value), "");
static_assert((std::is_same<decltype(std::ctime(&t)), char*>::value), "");
static_assert((std::is_same<decltype(std::gmtime(&t)), std::tm*>::value), "");
static_assert((std::is_same<decltype(std::localtime(&t)), std::tm*>::value), "");
#endif
char* c1 = 0;
const char* c2 = 0;
((void)c1); // Prevent unused warning

View File

@ -13,8 +13,6 @@
#include "test_macros.h"
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#ifndef LC_ALL
#error LC_ALL not defined
#endif
@ -39,8 +37,6 @@
#error LC_TIME not defined
#endif
#endif // !_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#ifndef NULL
#error NULL not defined
#endif
@ -49,9 +45,7 @@ int main(int, char**)
{
std::lconv lc;
((void)lc); // Prevent unused warning
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
static_assert((std::is_same<decltype(std::setlocale(0, "")), char*>::value), "");
#endif
static_assert((std::is_same<decltype(std::localeconv()), std::lconv*>::value), "");
return 0;

View File

@ -1,2 +0,0 @@
if 'libcpp-has-no-global-filesystem-namespace' in config.available_features:
config.unsupported = True

View File

@ -48,9 +48,7 @@ int main(int, char**)
ASSERT_SAME_TYPE(std::size_t, decltype(std::strspn(cpc, cpc)));
ASSERT_SAME_TYPE(char*, decltype(std::strstr(cp, cpc)));
ASSERT_SAME_TYPE(const char*, decltype(std::strstr(cpc, cpc)));
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
ASSERT_SAME_TYPE(char*, decltype(std::strtok(cp, cpc)));
#endif
ASSERT_SAME_TYPE(void*, decltype(std::memset(vp, 0, s)));
ASSERT_SAME_TYPE(char*, decltype(std::strerror(0)));
ASSERT_SAME_TYPE(std::size_t, decltype(std::strlen(cpc)));

View File

@ -116,17 +116,13 @@ int main(int, char**)
ASSERT_SAME_TYPE(std::size_t, decltype(std::mbsrtowcs(ws, (const char**)0, s, &mb)));
ASSERT_SAME_TYPE(std::size_t, decltype(std::wcsrtombs(ns, (const wchar_t**)0, s, &mb)));
#ifndef _LIBCPP_HAS_NO_STDIN
ASSERT_SAME_TYPE(std::wint_t, decltype(std::getwchar()));
ASSERT_SAME_TYPE(int, decltype(std::vwscanf(L"", va)));
ASSERT_SAME_TYPE(int, decltype(std::wscanf(L"")));
#endif
#ifndef _LIBCPP_HAS_NO_STDOUT
ASSERT_SAME_TYPE(std::wint_t, decltype(std::putwchar(L' ')));
ASSERT_SAME_TYPE(int, decltype(std::vwprintf(L"", va)));
ASSERT_SAME_TYPE(int, decltype(std::wprintf(L"")));
#endif
return 0;
}

View File

@ -25,17 +25,6 @@
# define LOCALE_fr_CA_ISO8859_1 "fr-CA"
# define LOCALE_ru_RU_UTF_8 "ru-RU"
# define LOCALE_zh_CN_UTF_8 "zh-CN"
#elif defined(__CloudABI__)
// Timezones are integrated into locales through LC_TIMEZONE_MASK on
// CloudABI. LC_ALL_MASK can only be used if a timezone has also been
// provided. UTC should be all right.
# define LOCALE_en_US "en_US"
# define LOCALE_en_US_UTF_8 "en_US.UTF-8@UTC"
# define LOCALE_fr_FR_UTF_8 "fr_FR.UTF-8@UTC"
# define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO-8859-1@UTC"
# define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO-8859-2@UTC"
# define LOCALE_ru_RU_UTF_8 "ru_RU.UTF-8@UTC"
# define LOCALE_zh_CN_UTF_8 "zh_CN.UTF-8@UTC"
#else
# define LOCALE_en_US "en_US"
# define LOCALE_en_US_UTF_8 "en_US.UTF-8"
@ -71,7 +60,6 @@ extern "C" {
}
#endif
#ifndef __CloudABI__
inline
std::string get_temp_file_name()
{
@ -110,8 +98,6 @@ std::wstring get_wide_temp_file_name()
}
#endif // _LIBCPP_HAS_OPEN_WITH_WCHAR
#endif // __CloudABI__
#if defined(_CS_GNU_LIBC_VERSION)
inline bool glibc_version_less_than(char const* version) {
std::string test_version = std::string("glibc ") + version;

View File

@ -89,11 +89,7 @@ DEFAULT_FEATURES = [
# `libcpp-xxx-yyy-zzz`. When a macro is defined to a specific value
# (e.g. `_LIBCPP_ABI_VERSION=2`), the feature is `libcpp-xxx-yyy-zzz=<value>`.
macros = {
'_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE': 'libcpp-has-no-global-filesystem-namespace',
'_LIBCPP_HAS_NO_MONOTONIC_CLOCK': 'libcpp-has-no-monotonic-clock',
'_LIBCPP_HAS_NO_STDIN': 'libcpp-has-no-stdin',
'_LIBCPP_HAS_NO_STDOUT': 'libcpp-has-no-stdout',
'_LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS': 'libcpp-has-no-thread-unsafe-c-functions',
'_LIBCPP_HAS_NO_THREADS': 'libcpp-has-no-threads',
'_LIBCPP_HAS_THREAD_API_EXTERNAL': 'libcpp-has-thread-api-external',
'_LIBCPP_HAS_THREAD_API_PTHREAD': 'libcpp-has-thread-api-pthread',