]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/src/c++98/globals_io.cc
re PR c++/51930 (Explicitly instantiated template gets hidden visibility)
[thirdparty/gcc.git] / libstdc++-v3 / src / c++98 / globals_io.cc
1 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011
2 // Free Software Foundation, Inc.
3 //
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)
8 // any later version.
9
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.
14
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.
18
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/>.
23
24 #include "bits/c++config.h"
25 #include <fstream>
26 #include <istream>
27 #include <ostream>
28 #include <ext/stdio_filebuf.h>
29 #include <ext/stdio_sync_filebuf.h>
30
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.
38
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")
44 // In macro form:
45 // _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2)
46
47 namespace std _GLIBCXX_VISIBILITY(default)
48 {
49 _GLIBCXX_BEGIN_NAMESPACE_VERSION
50
51 // Standard stream objects.
52 // NB: Iff <iostream> is included, these definitions become wonky.
53 typedef char fake_istream[sizeof(istream)]
54 __attribute__ ((aligned(__alignof__(istream))));
55 typedef char fake_ostream[sizeof(ostream)]
56 __attribute__ ((aligned(__alignof__(ostream))));
57 fake_istream cin;
58 fake_ostream cout;
59 fake_ostream cerr;
60 fake_ostream clog;
61
62 #ifdef _GLIBCXX_USE_WCHAR_T
63 typedef char fake_wistream[sizeof(wistream)]
64 __attribute__ ((aligned(__alignof__(wistream))));
65 typedef char fake_wostream[sizeof(wostream)]
66 __attribute__ ((aligned(__alignof__(wostream))));
67 fake_wistream wcin;
68 fake_wostream wcout;
69 fake_wostream wcerr;
70 fake_wostream wclog;
71 #endif
72
73 _GLIBCXX_END_NAMESPACE_VERSION
74 } // namespace
75
76 namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
77 {
78 using namespace std;
79 using namespace __gnu_cxx;
80
81 // We use different stream buffer types depending on whether
82 // ios_base::sync_with_stdio(false) has been called.
83 typedef char fake_stdiobuf[sizeof(stdio_sync_filebuf<char>)]
84 __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<char>))));
85 fake_stdiobuf buf_cout_sync;
86 fake_stdiobuf buf_cin_sync;
87 fake_stdiobuf buf_cerr_sync;
88
89 typedef char fake_filebuf[sizeof(stdio_filebuf<char>)]
90 __attribute__ ((aligned(__alignof__(stdio_filebuf<char>))));
91 fake_filebuf buf_cout;
92 fake_filebuf buf_cin;
93 fake_filebuf buf_cerr;
94
95 #ifdef _GLIBCXX_USE_WCHAR_T
96 typedef char fake_wstdiobuf[sizeof(stdio_sync_filebuf<wchar_t>)]
97 __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<wchar_t>))));
98 fake_wstdiobuf buf_wcout_sync;
99 fake_wstdiobuf buf_wcin_sync;
100 fake_wstdiobuf buf_wcerr_sync;
101
102 typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)]
103 __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>))));
104 fake_wfilebuf buf_wcout;
105 fake_wfilebuf buf_wcin;
106 fake_wfilebuf buf_wcerr;
107 #endif
108 } // namespace __gnu_internal