1 // Copyright (C) 2001 Free Software Foundation, Inc.
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
6 // Free Software Foundation; either version 2, or (at your option)
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.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING. If not, write to the Free
16 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
19 // As a special exception, you may use this file as part of a free software
20 // library without restriction. Specifically, if other files instantiate
21 // templates or use macros or inline functions from this file, or you compile
22 // this file and link it with other files to produce an executable, this
23 // file does not by itself cause the resulting executable to be covered by
24 // the GNU General Public License. This exception does not however
25 // invalidate any other reasons why the executable file might be covered by
26 // the GNU General Public License.
28 #include "bits/c++config.h"
29 #include "bits/gthr.h"
34 // On AIX, and perhaps other systems, library initialization order is
35 // not guaranteed. For example, the static initializers for the main
36 // program might run before the static initializers for this library.
37 // That means that we cannot rely on static initialization in the
38 // library; there is no guarantee that things will get initialized in
39 // time. This file contains definitions of all global variables that
40 // require initialization as arrays of characters.
42 // Because <iostream> declares the standard streams to be [io]stream
43 // types instead of say [io]fstream types, it is also necessary to
44 // allocate the actual file buffers in this file.
47 typedef char fake_istream
[sizeof(istream
)]
48 __attribute__ ((aligned(__alignof__(istream
))));
49 typedef char fake_ostream
[sizeof(ostream
)]
50 __attribute__ ((aligned(__alignof__(ostream
))));
56 typedef char fake_filebuf
[sizeof(filebuf
)]
57 __attribute__ ((aligned(__alignof__(filebuf
))));
58 fake_filebuf buf_cout
;
60 fake_filebuf buf_cerr
;
62 #ifdef _GLIBCPP_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
))));
72 typedef char fake_wfilebuf
[sizeof(wfilebuf
)]
73 __attribute__ ((aligned(__alignof__(wfilebuf
))));
74 fake_wfilebuf buf_wcout
;
75 fake_wfilebuf buf_wcin
;
76 fake_wfilebuf buf_wcerr
;
79 // Globals for once-only runtime initialization of mutex objects. This
80 // allows static initialization of these objects on systems that need a
81 // function call to initialize a mutex. For example, see stl_threads.h.
83 #ifdef __GTHREAD_MUTEX_INIT
84 // This path is not needed since static initialization of mutexs works
86 #elif defined(__GTHREAD_MUTEX_INIT_FUNCTION)
87 __gthread_once_t _GLIBCPP_once
= __GTHREAD_ONCE_INIT
;
88 __gthread_mutex_t _GLIBCPP_mutex
;
89 __gthread_mutex_t
*_GLIBCPP_mutex_address
;
91 // Once-only initializer function for _GLIBCPP_mutex.
93 _GLIBCPP_mutex_init ()
95 __GTHREAD_MUTEX_INIT_FUNCTION (&_GLIBCPP_mutex
);
97 // Once-only initializer function for _GLIBCPP_mutex_address.
99 _GLIBCPP_mutex_address_init ()
101 __GTHREAD_MUTEX_INIT_FUNCTION (_GLIBCPP_mutex_address
);