Import of virgin gcc 4.0.0 distribution.
[dragonfly.git] / contrib / gcc-4.0 / libstdc++-v3 / src / globals_locale.cc
1 // Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
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
6 // Free Software Foundation; either version 2, or (at your option)
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
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,
17 // USA.
18
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.
27
28 #include <locale>
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.
41 // The rename syntax is 
42 //   asm (".symver currentname,oldname@@GLIBCXX_3.2")
43 // In macro form:
44 // _GLIBCXX_ASM_SYMVER(currentname, oldname, GLIBCXX_3.2)
45
46 namespace __gnu_internal
47 {
48   using namespace std;
49
50   typedef char fake_locale_Impl[sizeof(locale::_Impl)]
51   __attribute__ ((aligned(__alignof__(locale::_Impl))));
52   fake_locale_Impl c_locale_impl;
53
54   typedef char fake_locale[sizeof(locale)]
55   __attribute__ ((aligned(__alignof__(locale))));
56   fake_locale c_locale;
57
58   typedef char fake_name_vec[sizeof(char*)]
59   __attribute__ ((aligned(__alignof__(char*))));
60   fake_name_vec name_vec[6 + _GLIBCXX_NUM_CATEGORIES];
61
62   typedef char fake_names[sizeof(char[2])]
63   __attribute__ ((aligned(__alignof__(char[2]))));
64   fake_names name_c[6 + _GLIBCXX_NUM_CATEGORIES];
65
66   typedef char fake_facet_vec[sizeof(locale::facet*)]
67   __attribute__ ((aligned(__alignof__(locale::facet*))));
68   fake_facet_vec facet_vec[_GLIBCXX_NUM_FACETS];
69
70   typedef char fake_cache_vec[sizeof(locale::facet*)]
71   __attribute__ ((aligned(__alignof__(locale::facet*))));
72   fake_cache_vec cache_vec[_GLIBCXX_NUM_FACETS];
73
74   typedef char fake_ctype_c[sizeof(std::ctype<char>)]
75   __attribute__ ((aligned(__alignof__(std::ctype<char>))));
76   fake_ctype_c ctype_c;
77
78   typedef char fake_collate_c[sizeof(std::collate<char>)]
79   __attribute__ ((aligned(__alignof__(std::collate<char>))));
80   fake_collate_c collate_c;
81
82   typedef char fake_numpunct_c[sizeof(numpunct<char>)]
83   __attribute__ ((aligned(__alignof__(numpunct<char>))));
84   fake_numpunct_c numpunct_c;
85
86   typedef char fake_num_get_c[sizeof(num_get<char>)]
87   __attribute__ ((aligned(__alignof__(num_get<char>))));
88   fake_num_get_c num_get_c;
89
90   typedef char fake_num_put_c[sizeof(num_put<char>)]
91   __attribute__ ((aligned(__alignof__(num_put<char>))));
92   fake_num_put_c num_put_c;
93
94   typedef char fake_codecvt_c[sizeof(codecvt<char, char, mbstate_t>)]
95   __attribute__ ((aligned(__alignof__(codecvt<char, char, mbstate_t>))));
96   fake_codecvt_c codecvt_c;
97
98   typedef char fake_moneypunct_c[sizeof(moneypunct<char, true>)]
99   __attribute__ ((aligned(__alignof__(moneypunct<char, true>))));
100   fake_moneypunct_c moneypunct_ct;
101   fake_moneypunct_c moneypunct_cf;
102
103   typedef char fake_money_get_c[sizeof(money_get<char>)]
104   __attribute__ ((aligned(__alignof__(money_get<char>))));
105   fake_money_get_c money_get_c;
106   
107   typedef char fake_money_put_c[sizeof(money_put<char>)]
108   __attribute__ ((aligned(__alignof__(money_put<char>))));
109   fake_money_put_c money_put_c;
110
111   typedef char fake_timepunct_c[sizeof(__timepunct<char>)]
112   __attribute__ ((aligned(__alignof__(__timepunct<char>))));
113   fake_timepunct_c timepunct_c;
114
115   typedef char fake_time_get_c[sizeof(time_get<char>)]
116   __attribute__ ((aligned(__alignof__(time_get<char>))));
117   fake_time_get_c time_get_c;
118
119   typedef char fake_time_put_c[sizeof(time_put<char>)]
120   __attribute__ ((aligned(__alignof__(time_put<char>))));
121   fake_time_put_c time_put_c;
122
123   typedef char fake_messages_c[sizeof(messages<char>)]
124   __attribute__ ((aligned(__alignof__(messages<char>))));
125   fake_messages_c messages_c;
126
127 #ifdef  _GLIBCXX_USE_WCHAR_T
128   typedef char fake_wtype_w[sizeof(std::ctype<wchar_t>)]
129   __attribute__ ((aligned(__alignof__(std::ctype<wchar_t>))));
130   fake_wtype_w ctype_w;
131
132   typedef char fake_wollate_w[sizeof(std::collate<wchar_t>)]
133   __attribute__ ((aligned(__alignof__(std::collate<wchar_t>))));
134   fake_wollate_w collate_w;
135
136   typedef char fake_numpunct_w[sizeof(numpunct<wchar_t>)]
137   __attribute__ ((aligned(__alignof__(numpunct<wchar_t>))));
138   fake_numpunct_w numpunct_w;
139
140   typedef char fake_num_get_w[sizeof(num_get<wchar_t>)]
141   __attribute__ ((aligned(__alignof__(num_get<wchar_t>))));
142   fake_num_get_w num_get_w;
143
144   typedef char fake_num_put_w[sizeof(num_put<wchar_t>)]
145   __attribute__ ((aligned(__alignof__(num_put<wchar_t>))));
146   fake_num_put_w num_put_w;
147
148   typedef char fake_wodecvt_w[sizeof(codecvt<wchar_t, char, mbstate_t>)]
149   __attribute__ ((aligned(__alignof__(codecvt<wchar_t, char, mbstate_t>))));
150   fake_wodecvt_w codecvt_w;
151
152   typedef char fake_moneypunct_w[sizeof(moneypunct<wchar_t, true>)]
153   __attribute__ ((aligned(__alignof__(moneypunct<wchar_t, true>))));
154   fake_moneypunct_w moneypunct_wt;
155   fake_moneypunct_w moneypunct_wf;
156
157   typedef char fake_money_get_w[sizeof(money_get<wchar_t>)]
158   __attribute__ ((aligned(__alignof__(money_get<wchar_t>))));
159   fake_money_get_w money_get_w;
160   
161   typedef char fake_money_put_w[sizeof(money_put<wchar_t>)]
162   __attribute__ ((aligned(__alignof__(money_put<wchar_t>))));
163   fake_money_put_w money_put_w;
164
165   typedef char fake_timepunct_w[sizeof(__timepunct<wchar_t>)]
166   __attribute__ ((aligned(__alignof__(__timepunct<wchar_t>))));
167   fake_timepunct_w timepunct_w;
168
169   typedef char fake_time_get_w[sizeof(time_get<wchar_t>)]
170   __attribute__ ((aligned(__alignof__(time_get<wchar_t>))));
171   fake_time_get_w time_get_w;
172
173   typedef char fake_time_put_w[sizeof(time_put<wchar_t>)]
174   __attribute__ ((aligned(__alignof__(time_put<wchar_t>))));
175   fake_time_put_w time_put_w;
176
177   typedef char fake_messages_w[sizeof(messages<wchar_t>)]
178   __attribute__ ((aligned(__alignof__(messages<wchar_t>))));
179   fake_messages_w messages_w;
180 #endif
181
182   // Storage for "C" locale caches.
183   typedef char fake_num_cache_c[sizeof(std::__numpunct_cache<char>)]
184   __attribute__ ((aligned(__alignof__(std::__numpunct_cache<char>))));
185   fake_num_cache_c numpunct_cache_c;
186
187   typedef char fake_money_cache_c[sizeof(std::__moneypunct_cache<char, true>)]
188   __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<char, true>))));
189   fake_money_cache_c moneypunct_cache_ct;
190   fake_money_cache_c moneypunct_cache_cf;
191
192   typedef char fake_time_cache_c[sizeof(std::__timepunct_cache<char>)]
193   __attribute__ ((aligned(__alignof__(std::__timepunct_cache<char>))));
194   fake_time_cache_c timepunct_cache_c;
195
196 #ifdef _GLIBCXX_USE_WCHAR_T
197   typedef char fake_num_cache_w[sizeof(std::__numpunct_cache<wchar_t>)]
198   __attribute__ ((aligned(__alignof__(std::__numpunct_cache<wchar_t>))));
199   fake_num_cache_w numpunct_cache_w;
200
201   typedef char fake_money_cache_w[sizeof(std::__moneypunct_cache<wchar_t,true>)]
202   __attribute__ ((aligned(__alignof__(std::__moneypunct_cache<wchar_t,true>))));
203   fake_money_cache_w moneypunct_cache_wt;
204   fake_money_cache_w moneypunct_cache_wf;
205
206   typedef char fake_time_cache_w[sizeof(std::__timepunct_cache<wchar_t>)]
207   __attribute__ ((aligned(__alignof__(std::__timepunct_cache<wchar_t>))));
208   fake_time_cache_w timepunct_cache_w;
209 #endif
210 } // namespace __gnu_internal