llvm-project/libcxx/include
Ed Schouten f4ac884f2b Make the presence of stdin and stdout optional.
The idea behind Nuxi CloudABI is that it is targeted at (but not limited to)
running networked services in a sandboxed environment. The model behind stdin,
stdout and stderr is strongly focused on interactive tools in a command shell.
CloudABI does not support the notion of stdin and stdout, as 'standard
input/output' does not apply to services. The concept of stderr does makes
sense though, as services do need some mechanism to log error messages in a
uniform way.

This patch extends libc++ in such a way that std::cin and std::cout and the
associated <cstdio>/<cwchar> functions can be disabled through the flags
_LIBCPP_HAS_NO_STDIN and _LIBCPP_HAS_NO_STDOUT, respectively. At the same time
it attempts to clean up src/iostream.cpp a bit. Instead of using a single array
of mbstate_t objects and hardcoding the array indices, it creates separate
objects that declared next to the iostream objects and their buffers. The code
is also restructured by interleaving the construction and setup of c* and wc*
objects. That way it is more obvious that this is done identically.

The c* and wc* objects already have separate unit tests. Make use of this fact
by adding XFAILs in case libcpp-has-no-std* is set. That way the tests work in
both directions. If stdin or stdout is disabled, these tests will therefore
test for the absence of c* and wc*.

Differential Revision:	http://reviews.llvm.org/D8340

llvm-svn: 233275
2015-03-26 14:35:46 +00:00
..
experimental [libcxx] Add <experimental/tuple> header for LFTS. 2015-03-17 18:28:14 +00:00
ext Do not derive __gnu_cxx::hash<T> from std::hash<T>. 2014-03-06 04:11:10 +00:00
support cmath: account for MSVCRT 12.0 changes 2015-02-28 20:18:39 +00:00
CMakeLists.txt Add option to turn off installation of headers. 2014-12-12 22:52:58 +00:00
__bit_reference Get tests running with warnings. Fix warnings in headers and tests 2015-02-05 20:28:37 +00:00
__config Make the presence of stdin and stdout optional. 2015-03-26 14:35:46 +00:00
__debug Print log/error messages on stderr, not stdout 2015-03-10 07:57:43 +00:00
__functional_03 [libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions 2015-02-10 16:48:45 +00:00
__functional_base [libcxx] Add <experimental/tuple> header for LFTS. 2015-03-17 18:28:14 +00:00
__functional_base_03 [libcxx] Fix PR 22468 - std::function<void()> does not accept non-void-returning functions 2015-02-10 16:48:45 +00:00
__hash_table Remove several unused forward declarations. Fixes PR22605. 2015-02-18 19:28:35 +00:00
__locale Fix ctype_byname<wchar_t>::do_is() mask checking.... again 2015-03-11 17:00:28 +00:00
__mutex_base Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
__refstring Fix some -Wundef issues. 2015-02-05 02:34:59 +00:00
__split_buffer G M: Changes all references to "x inline" to "inline x" where x = _libcpp_always_inline or _libcpp_inline_visibility macros. 2013-10-04 22:09:00 +00:00
__sso_allocator Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
__std_stream Partial implementation of N3665. This paper was not voted into the C++1y draft. However I was looking at it and with some experimentation realized that I could partially implement it, and at the same time offer a performance optimization to cout. I simply added an xsputn override to the cout filebuf. The override does nothing special at all if there is a non-trivial codecvt installed. However if the codecvt returns true for always_noconv(), then this function can dump an entire string to fwrite, instead of doing it a character at a time under overflow(). This just makes sense. I stopped short of a full implementation of N3665 because in order to do so, xsputn would have to allocate a buffer when always_noconv() returned false, and I don't want to go to that expense. 2013-08-09 16:25:43 +00:00
__tree Fix another -Wunused-local-typedef warning in include/__tree. 2015-03-09 21:39:02 +00:00
__tuple [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block. 2015-03-17 15:08:03 +00:00
__undef___deallocate Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
__undef_min_max Fix-it suggestion for fixing min or max defines on Windows. 2013-11-15 23:41:01 +00:00
algorithm Fix PR 22541: When values are equal, minmax should return the rightmost one in the initializer_list 2015-02-11 15:41:34 +00:00
array [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block. 2015-03-17 15:08:03 +00:00
atomic Change a couple more template parameter names from 'T' to '_Tp', etc. Thanks to Ondřej Majerech for the patch, but I did a bit more. 2015-01-11 06:15:59 +00:00
bitset Make locales (and transitively, std::endl) work reliably with gcc. 2014-06-04 15:46:56 +00:00
cassert Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
ccomplex Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cctype cctype: tweak inclusions for _LIBCPP_MSVCRT case 2015-02-13 22:15:28 +00:00
cerrno Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cfenv Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cfloat Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
chrono Partially address a FIXME in steady_clock::now() 2014-09-02 21:14:38 +00:00
cinttypes Make *abs() and *div() work on CloudABI. 2015-03-16 14:27:44 +00:00
ciso646 Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
climits Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
clocale Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cmath Provide std::abs(<floating-point>) in <cmath> on Solaris. 2015-03-18 15:24:18 +00:00
codecvt Update synopsis in <locale> to match LWG Issue 2229. No code change 2013-08-27 14:22:13 +00:00
complex Implement literal suffixes for compled 2013-10-05 21:19:49 +00:00
complex.h Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
condition_variable Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
csetjmp Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
csignal Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cstdarg Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cstdbool Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cstddef Update cstddef after clang r207606. 2014-05-16 01:45:02 +00:00
cstdint Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cstdio Make the presence of stdin and stdout optional. 2015-03-26 14:35:46 +00:00
cstdlib Make *abs() and *div() work on CloudABI. 2015-03-16 14:27:44 +00:00
cstring Nico Rieck: Currently _MSC_VER and _WIN32 are used to guard code which is 2013-08-01 18:17:34 +00:00
ctgmath Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
ctime Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
cwchar Make the presence of stdin and stdout optional. 2015-03-26 14:35:46 +00:00
cwctype Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
deque Fix an exception-safety bug in <deque>. Reference: PR#22650. Not closing the bug because there's more work to do here 2015-03-09 17:08:51 +00:00
exception Fix a problem when calling throw_with_nested with a class marked 'final'. Thanks to STL @ Microsoft for the bug report. 2015-03-16 15:10:28 +00:00
forward_list Move the default template arguments into the forward declarations for the containers: deque, forwardlist and list. References PR#22605. 2015-02-18 17:24:08 +00:00
fstream Add option to disable access to the global filesystem namespace. 2015-03-12 15:44:39 +00:00
functional [libc++] Fix PR22922 - Allocator support for std::function does not know how to rebind. 2015-03-18 22:56:50 +00:00
future Remove use of _[A-Z] identifiers and poison them to detect usage 2015-02-05 23:01:40 +00:00
initializer_list Apply constexpr to initializer_list for c++1y. 2013-08-26 20:11:32 +00:00
iomanip Implement LWG #2344: quoted()'s interaction with padding is unclear. I think that anyone using quoted with padding is really confused, but it should work the way the rest of iostreams works. 2014-03-07 21:45:32 +00:00
ios Address some post-commit review comments on r217261 2014-09-05 20:28:44 +00:00
iosfwd Revert: Revert r227804: Use fseek/ftell instead of fseeko/ftello when Newlib is the libc 2015-02-03 15:34:17 +00:00
iostream Make the presence of stdin and stdout optional. 2015-03-26 14:35:46 +00:00
istream K-ballo pointed out *another* mistype in my change 2014-09-17 01:58:15 +00:00
iterator Rework reverse_iterator::operator[] so as not to use the base iterators operator [], which can cause constness problems. Fixes PR17883 2015-03-05 16:07:37 +00:00
limits libc++: integral types trap on PNaCl 2014-11-26 17:51:58 +00:00
list Fix use after free and calls to operator comma in debug mode 2015-03-19 03:20:02 +00:00
locale Add support for kfreebsd. Thanks to Jan Henke 2015-03-19 09:03:58 +00:00
map Allow declaration of map and multimap iterator with incomplete mapped type. Patch from eugenis 2015-03-03 20:10:01 +00:00
memory Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
module.modulemap Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
mutex Explicitly include <sched.h> for sched_yield() 2014-12-08 14:50:21 +00:00
new More on adding sized deallocation functions in libc++: Continuing from r229281, this adds version guards and test cases. 2015-02-20 06:13:05 +00:00
numeric [libcxx] Fix use of operator comma where the types can be user defined 2014-10-27 19:28:20 +00:00
ostream K-ballo pointed out *another* mistype in my change 2014-09-17 01:58:15 +00:00
queue Move the default template arguments into the forward declarations for the container adapters: stack and queue. References PR#22605. 2015-02-18 17:51:56 +00:00
random Add support for arc4random() to random_device. 2015-03-10 07:46:06 +00:00
ratio Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. 2013-08-12 18:38:34 +00:00
regex Add code to honor the match_not_bol and match_not_eol regex flats. Fixes PR#22651. Thanks to Jim Porter for the report and suggested fix. 2015-03-19 17:05:59 +00:00
scoped_allocator Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. 2013-08-12 18:38:34 +00:00
set Fix bug 20740 - std::set/std::map don't support heterogeneous lookup for count(). Thanks to Jim Porter for the bug report 2014-08-24 23:54:16 +00:00
shared_mutex Allow libc++ to be built on systems without POSIX threads 2014-09-05 19:45:05 +00:00
sstream Fix a bug in the move-assigment operator for basic_stringbuf. Thanks to Johnathan Wakeley for the bug report 2014-09-16 18:57:52 +00:00
stack Move the default template arguments into the forward declarations for the container adapters: stack and queue. References PR#22605. 2015-02-18 17:51:56 +00:00
stdexcept Fix unused private field warning in stdexcept after r207695. 2015-02-05 07:40:48 +00:00
streambuf Make basic_streambuf::xsputn write characters in chunks whenever possible, instead of one at a time. References PR#10193 2015-02-19 16:17:46 +00:00
string Rooting out more undefined behavior in char_traits. 2015-02-13 16:04:42 +00:00
strstream No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute. 2013-03-06 23:30:19 +00:00
system_error G M: Improve support for compilers not supporting defaulted functions. 2013-08-24 21:31:37 +00:00
tgmath.h Windows support by Ruben Van Boxem. 2011-10-17 20:05:10 +00:00
thread Explicitly include <sched.h> for sched_yield() 2014-12-08 14:50:21 +00:00
tuple Remove unneeded redeclaration of reference_wrapper. 2015-03-21 06:05:45 +00:00
type_traits Create macro to allow testing of is_convertible without the compiler builtin. 2015-03-19 21:11:02 +00:00
typeindex Nico Rieck: this patch series fixes visibility issues on Windows as explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. 2013-08-12 18:38:34 +00:00
typeinfo RTTI Uniqueness: remove __name_for_load function. 2014-04-03 09:12:38 +00:00
unordered_map NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards. 2014-08-10 23:53:08 +00:00
unordered_set NFC. Move definition of _LIBCPP_ASSERT into __debug header and remove external include guards. 2014-08-10 23:53:08 +00:00
utility [libcxx] Move tuple_size and tuple_element overloads for pair and array out of !defined(_LIBCPP_HAS_NO_VARIADICS) block. 2015-03-17 15:08:03 +00:00
valarray Handle function name conflicts in _LIBCPP_MSVCRT mode 2015-02-13 22:15:32 +00:00
vector [libcxx] Fix __RAII_IncreaseAnnotator for increases >= 1 2015-03-10 00:25:20 +00:00