]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/src/c++98/globals_io.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / src / c++98 / globals_io.cc
CommitLineData
83ffe9cd 1// Copyright (C) 2001-2023 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
46namespace 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
ec598480
PP
72#include "ios_base_init.h"
73
12ffa228
BK
74_GLIBCXX_END_NAMESPACE_VERSION
75} // namespace
c755e77d 76
12ffa228 77namespace __gnu_internal _GLIBCXX_VISIBILITY(hidden)
c755e77d
BK
78{
79 using namespace std;
ff4cf05b 80 using namespace __gnu_cxx;
c755e77d
BK
81
82 // We use different stream buffer types depending on whether
83 // ios_base::sync_with_stdio(false) has been called.
84 typedef char fake_stdiobuf[sizeof(stdio_sync_filebuf<char>)]
85 __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<char>))));
86 fake_stdiobuf buf_cout_sync;
87 fake_stdiobuf buf_cin_sync;
88 fake_stdiobuf buf_cerr_sync;
89
90 typedef char fake_filebuf[sizeof(stdio_filebuf<char>)]
91 __attribute__ ((aligned(__alignof__(stdio_filebuf<char>))));
92 fake_filebuf buf_cout;
93 fake_filebuf buf_cin;
94 fake_filebuf buf_cerr;
95
96#ifdef _GLIBCXX_USE_WCHAR_T
97 typedef char fake_wstdiobuf[sizeof(stdio_sync_filebuf<wchar_t>)]
98 __attribute__ ((aligned(__alignof__(stdio_sync_filebuf<wchar_t>))));
99 fake_wstdiobuf buf_wcout_sync;
100 fake_wstdiobuf buf_wcin_sync;
101 fake_wstdiobuf buf_wcerr_sync;
102
103 typedef char fake_wfilebuf[sizeof(stdio_filebuf<wchar_t>)]
104 __attribute__ ((aligned(__alignof__(stdio_filebuf<wchar_t>))));
105 fake_wfilebuf buf_wcout;
106 fake_wfilebuf buf_wcin;
107 fake_wfilebuf buf_wcerr;
108#endif
ff4cf05b 109} // namespace __gnu_internal