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