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