This is an optimization which produces improved launching time. There should be no functionality change. Clients should see no ABI differences.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177443 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Howard Hinnant
2013-03-19 21:34:48 +00:00
parent c19fe86743
commit 903439f735
2 changed files with 22 additions and 20 deletions

View File

@@ -13,6 +13,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
static mbstate_t state_types[6] = {};
_ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin [sizeof(__stdinbuf <char>)];
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
@@ -33,17 +35,17 @@ ios_base::Init __start_std_streams;
ios_base::Init::Init()
{
istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin) );
ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout));
ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr));
istream* cin_ptr = ::new(cin) istream(::new(__cin) __stdinbuf <char>(stdin, state_types+0) );
ostream* cout_ptr = ::new(cout) ostream(::new(__cout) __stdoutbuf<char>(stdout, state_types+1));
ostream* cerr_ptr = ::new(cerr) ostream(::new(__cerr) __stdoutbuf<char>(stderr, state_types+2));
::new(clog) ostream(cerr_ptr->rdbuf());
cin_ptr->tie(cout_ptr);
_VSTD::unitbuf(*cerr_ptr);
cerr_ptr->tie(cout_ptr);
wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin) );
wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout));
wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr));
wistream* wcin_ptr = ::new(wcin) wistream(::new(__wcin) __stdinbuf <wchar_t>(stdin, state_types+3) );
wostream* wcout_ptr = ::new(wcout) wostream(::new(__wcout) __stdoutbuf<wchar_t>(stdout, state_types+4));
wostream* wcerr_ptr = ::new(wcerr) wostream(::new(__wcerr) __stdoutbuf<wchar_t>(stderr, state_types+5));
::new(wclog) wostream(wcerr_ptr->rdbuf());
wcin_ptr->tie(wcout_ptr);
_VSTD::unitbuf(*wcerr_ptr);