1*e4b17023SJohn Marino // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 2*e4b17023SJohn Marino // Free Software Foundation, Inc. 3*e4b17023SJohn Marino // 4*e4b17023SJohn Marino // This file is part of the GNU ISO C++ Library. This library is free 5*e4b17023SJohn Marino // software; you can redistribute it and/or modify it under the 6*e4b17023SJohn Marino // terms of the GNU General Public License as published by the 7*e4b17023SJohn Marino // Free Software Foundation; either version 3, or (at your option) 8*e4b17023SJohn Marino // any later version. 9*e4b17023SJohn Marino 10*e4b17023SJohn Marino // This library is distributed in the hope that it will be useful, 11*e4b17023SJohn Marino // but WITHOUT ANY WARRANTY; without even the implied warranty of 12*e4b17023SJohn Marino // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*e4b17023SJohn Marino // GNU General Public License for more details. 14*e4b17023SJohn Marino 15*e4b17023SJohn Marino // Under Section 7 of GPL version 3, you are granted additional 16*e4b17023SJohn Marino // permissions described in the GCC Runtime Library Exception, version 17*e4b17023SJohn Marino // 3.1, as published by the Free Software Foundation. 18*e4b17023SJohn Marino 19*e4b17023SJohn Marino // You should have received a copy of the GNU General Public License and 20*e4b17023SJohn Marino // a copy of the GCC Runtime Library Exception along with this program; 21*e4b17023SJohn Marino // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 22*e4b17023SJohn Marino // <http://www.gnu.org/licenses/>. 23*e4b17023SJohn Marino 24*e4b17023SJohn Marino #include "bits/c++config.h" 25*e4b17023SJohn Marino #include <fstream> 26*e4b17023SJohn Marino #include <istream> 27*e4b17023SJohn Marino #include <ostream> 28*e4b17023SJohn Marino #include <ext/stdio_filebuf.h> 29*e4b17023SJohn Marino #include <ext/stdio_sync_filebuf.h> 30*e4b17023SJohn Marino 31*e4b17023SJohn Marino // On AIX, and perhaps other systems, library initialization order is 32*e4b17023SJohn Marino // not guaranteed. For example, the static initializers for the main 33*e4b17023SJohn Marino // program might run before the static initializers for this library. 34*e4b17023SJohn Marino // That means that we cannot rely on static initialization in the 35*e4b17023SJohn Marino // library; there is no guarantee that things will get initialized in 36*e4b17023SJohn Marino // time. This file contains definitions of all global variables that 37*e4b17023SJohn Marino // require initialization as arrays of characters. 38*e4b17023SJohn Marino 39*e4b17023SJohn Marino // NB: asm directives can rename these non-exported, namespace 40*e4b17023SJohn Marino // __gnu_cxx symbols into exported, namespace std symbols with the 41*e4b17023SJohn Marino // appropriate symbol version name. 42*e4b17023SJohn Marino // The rename syntax is 43*e4b17023SJohn Marino // asm (".symver currentname,oldname@@GLIBCXX_3.2") 44*e4b17023SJohn Marino // In macro form: 45*e4b17023SJohn Marino // _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2) 46*e4b17023SJohn Marino 47*e4b17023SJohn Marino namespace std _GLIBCXX_VISIBILITY(default) 48*e4b17023SJohn Marino { 49*e4b17023SJohn Marino _GLIBCXX_BEGIN_NAMESPACE_VERSION 50*e4b17023SJohn Marino 51*e4b17023SJohn Marino // Standard stream objects. 52*e4b17023SJohn Marino // NB: Iff <iostream> is included, these definitions become wonky. 53*e4b17023SJohn Marino typedef char fake_istream[sizeof(istream)] 54*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(istream)))); 55*e4b17023SJohn Marino typedef char fake_ostream[sizeof(ostream)] 56*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(ostream)))); 57*e4b17023SJohn Marino fake_istream cin; 58*e4b17023SJohn Marino fake_ostream cout; 59*e4b17023SJohn Marino fake_ostream cerr; 60*e4b17023SJohn Marino fake_ostream clog; 61*e4b17023SJohn Marino 62*e4b17023SJohn Marino #ifdef _GLIBCXX_USE_WCHAR_T 63*e4b17023SJohn Marino typedef char fake_wistream[sizeof(wistream)] 64*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(wistream)))); 65*e4b17023SJohn Marino typedef char fake_wostream[sizeof(wostream)] 66*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(wostream)))); 67*e4b17023SJohn Marino fake_wistream wcin; 68*e4b17023SJohn Marino fake_wostream wcout; 69*e4b17023SJohn Marino fake_wostream wcerr; 70*e4b17023SJohn Marino fake_wostream wclog; 71*e4b17023SJohn Marino #endif 72*e4b17023SJohn Marino 73*e4b17023SJohn Marino _GLIBCXX_END_NAMESPACE_VERSION 74*e4b17023SJohn Marino } // namespace 75*e4b17023SJohn Marino 76*e4b17023SJohn Marino namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden) 77*e4b17023SJohn Marino { 78*e4b17023SJohn Marino using namespace std; 79*e4b17023SJohn Marino using namespace __gnu_cxx; 80*e4b17023SJohn Marino 81*e4b17023SJohn Marino // We use different stream buffer types depending on whether 82*e4b17023SJohn Marino // ios_base::sync_with_stdio(false) has been called. 83*e4b17023SJohn Marino typedef char fake_stdiobuf[sizeof(stdio_sync_filebuf<char>)] 84*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<char>)))); 85*e4b17023SJohn Marino fake_stdiobuf buf_cout_sync; 86*e4b17023SJohn Marino fake_stdiobuf buf_cin_sync; 87*e4b17023SJohn Marino fake_stdiobuf buf_cerr_sync; 88*e4b17023SJohn Marino 89*e4b17023SJohn Marino typedef char fake_filebuf[sizeof(stdio_filebuf<char>)] 90*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(stdio_filebuf<char>)))); 91*e4b17023SJohn Marino fake_filebuf buf_cout; 92*e4b17023SJohn Marino fake_filebuf buf_cin; 93*e4b17023SJohn Marino fake_filebuf buf_cerr; 94*e4b17023SJohn Marino 95*e4b17023SJohn Marino #ifdef _GLIBCXX_USE_WCHAR_T 96*e4b17023SJohn Marino typedef char fake_wstdiobuf[sizeof(stdio_sync_filebuf<wchar_t>)] 97*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<wchar_t>)))); 98*e4b17023SJohn Marino fake_wstdiobuf buf_wcout_sync; 99*e4b17023SJohn Marino fake_wstdiobuf buf_wcin_sync; 100*e4b17023SJohn Marino fake_wstdiobuf buf_wcerr_sync; 101*e4b17023SJohn Marino 102*e4b17023SJohn Marino typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)] 103*e4b17023SJohn Marino __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>)))); 104*e4b17023SJohn Marino fake_wfilebuf buf_wcout; 105*e4b17023SJohn Marino fake_wfilebuf buf_wcin; 106*e4b17023SJohn Marino fake_wfilebuf buf_wcerr; 107*e4b17023SJohn Marino #endif 108*e4b17023SJohn Marino } // namespace __gnu_internal 109