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