1 // Copyright (C) 1997-2017 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 3, 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 // 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.
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/>.
23 #define _GLIBCXX_USE_CXX11_ABI 1
26 #include <cstdlib> // For free.
28 #include <cwctype> // For towupper, etc.
30 #include <ext/concurrence.h>
32 #if _GLIBCXX_USE_DUAL_ABI
33 // This file is compiled with the new std::string ABI so std::numpunct<char>
34 // refers to std::__cxx11::numpunct<char>. These declarations let us refer
35 // to the other facets instantiated with the old ABI.
36 # define _GLIBCXX_LOC_ID(mangled) extern std::locale::id mangled
37 _GLIBCXX_LOC_ID(_ZNSt8numpunctIcE2idE
);
38 _GLIBCXX_LOC_ID(_ZNSt7collateIcE2idE
);
39 _GLIBCXX_LOC_ID(_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE
);
40 _GLIBCXX_LOC_ID(_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE
);
41 _GLIBCXX_LOC_ID(_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE
);
42 _GLIBCXX_LOC_ID(_ZNSt10moneypunctIcLb0EE2idE
);
43 _GLIBCXX_LOC_ID(_ZNSt10moneypunctIcLb1EE2idE
);
44 _GLIBCXX_LOC_ID(_ZNSt8messagesIcE2idE
);
45 # ifdef _GLIBCXX_USE_WCHAR_T
46 _GLIBCXX_LOC_ID(_ZNSt8numpunctIwE2idE
);
47 _GLIBCXX_LOC_ID(_ZNSt7collateIwE2idE
);
48 _GLIBCXX_LOC_ID(_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE
);
49 _GLIBCXX_LOC_ID(_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE
);
50 _GLIBCXX_LOC_ID(_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE
);
51 _GLIBCXX_LOC_ID(_ZNSt10moneypunctIwLb0EE2idE
);
52 _GLIBCXX_LOC_ID(_ZNSt10moneypunctIwLb1EE2idE
);
53 _GLIBCXX_LOC_ID(_ZNSt8messagesIwE2idE
);
60 const int num_facets
= _GLIBCXX_NUM_FACETS
+ _GLIBCXX_NUM_UNICODE_FACETS
61 + (_GLIBCXX_USE_DUAL_ABI
? _GLIBCXX_NUM_CXX11_FACETS
: 0);
66 static __gnu_cxx::__mutex locale_mutex
;
72 typedef char fake_locale_Impl
[sizeof(locale::_Impl
)]
73 __attribute__ ((aligned(__alignof__(locale::_Impl
))));
74 fake_locale_Impl c_locale_impl
;
76 typedef char fake_locale
[sizeof(locale
)]
77 __attribute__ ((aligned(__alignof__(locale
))));
80 typedef char fake_name_vec
[sizeof(char*)]
81 __attribute__ ((aligned(__alignof__(char*))));
82 fake_name_vec name_vec
[6 + _GLIBCXX_NUM_CATEGORIES
];
84 typedef char fake_names
[sizeof(char[2])]
85 __attribute__ ((aligned(__alignof__(char[2]))));
86 fake_names name_c
[6 + _GLIBCXX_NUM_CATEGORIES
];
88 typedef char fake_facet_vec
[sizeof(locale::facet
*)]
89 __attribute__ ((aligned(__alignof__(locale::facet
*))));
90 fake_facet_vec facet_vec
[num_facets
];
92 typedef char fake_cache_vec
[sizeof(locale::facet
*)]
93 __attribute__ ((aligned(__alignof__(locale::facet
*))));
94 fake_cache_vec cache_vec
[num_facets
];
96 typedef char fake_ctype_c
[sizeof(std::ctype
<char>)]
97 __attribute__ ((aligned(__alignof__(std::ctype
<char>))));
100 typedef char fake_collate_c
[sizeof(std::collate
<char>)]
101 __attribute__ ((aligned(__alignof__(std::collate
<char>))));
102 fake_collate_c collate_c
;
104 typedef char fake_numpunct_c
[sizeof(numpunct
<char>)]
105 __attribute__ ((aligned(__alignof__(numpunct
<char>))));
106 fake_numpunct_c numpunct_c
;
108 typedef char fake_num_get_c
[sizeof(num_get
<char>)]
109 __attribute__ ((aligned(__alignof__(num_get
<char>))));
110 fake_num_get_c num_get_c
;
112 typedef char fake_num_put_c
[sizeof(num_put
<char>)]
113 __attribute__ ((aligned(__alignof__(num_put
<char>))));
114 fake_num_put_c num_put_c
;
116 typedef char fake_codecvt_c
[sizeof(codecvt
<char, char, mbstate_t>)]
117 __attribute__ ((aligned(__alignof__(codecvt
<char, char, mbstate_t>))));
118 fake_codecvt_c codecvt_c
;
120 typedef char fake_moneypunct_c
[sizeof(moneypunct
<char, true>)]
121 __attribute__ ((aligned(__alignof__(moneypunct
<char, true>))));
122 fake_moneypunct_c moneypunct_ct
;
123 fake_moneypunct_c moneypunct_cf
;
125 typedef char fake_money_get_c
[sizeof(money_get
<char>)]
126 __attribute__ ((aligned(__alignof__(money_get
<char>))));
127 fake_money_get_c money_get_c
;
129 typedef char fake_money_put_c
[sizeof(money_put
<char>)]
130 __attribute__ ((aligned(__alignof__(money_put
<char>))));
131 fake_money_put_c money_put_c
;
133 typedef char fake_timepunct_c
[sizeof(__timepunct
<char>)]
134 __attribute__ ((aligned(__alignof__(__timepunct
<char>))));
135 fake_timepunct_c timepunct_c
;
137 typedef char fake_time_get_c
[sizeof(time_get
<char>)]
138 __attribute__ ((aligned(__alignof__(time_get
<char>))));
139 fake_time_get_c time_get_c
;
141 typedef char fake_time_put_c
[sizeof(time_put
<char>)]
142 __attribute__ ((aligned(__alignof__(time_put
<char>))));
143 fake_time_put_c time_put_c
;
145 typedef char fake_messages_c
[sizeof(messages
<char>)]
146 __attribute__ ((aligned(__alignof__(messages
<char>))));
147 fake_messages_c messages_c
;
149 #ifdef _GLIBCXX_USE_WCHAR_T
150 typedef char fake_wtype_w
[sizeof(std::ctype
<wchar_t>)]
151 __attribute__ ((aligned(__alignof__(std::ctype
<wchar_t>))));
152 fake_wtype_w ctype_w
;
154 typedef char fake_wollate_w
[sizeof(std::collate
<wchar_t>)]
155 __attribute__ ((aligned(__alignof__(std::collate
<wchar_t>))));
156 fake_wollate_w collate_w
;
158 typedef char fake_numpunct_w
[sizeof(numpunct
<wchar_t>)]
159 __attribute__ ((aligned(__alignof__(numpunct
<wchar_t>))));
160 fake_numpunct_w numpunct_w
;
162 typedef char fake_num_get_w
[sizeof(num_get
<wchar_t>)]
163 __attribute__ ((aligned(__alignof__(num_get
<wchar_t>))));
164 fake_num_get_w num_get_w
;
166 typedef char fake_num_put_w
[sizeof(num_put
<wchar_t>)]
167 __attribute__ ((aligned(__alignof__(num_put
<wchar_t>))));
168 fake_num_put_w num_put_w
;
170 typedef char fake_wodecvt_w
[sizeof(codecvt
<wchar_t, char, mbstate_t>)]
171 __attribute__ ((aligned(__alignof__(codecvt
<wchar_t, char, mbstate_t>))));
172 fake_wodecvt_w codecvt_w
;
174 typedef char fake_moneypunct_w
[sizeof(moneypunct
<wchar_t, true>)]
175 __attribute__ ((aligned(__alignof__(moneypunct
<wchar_t, true>))));
176 fake_moneypunct_w moneypunct_wt
;
177 fake_moneypunct_w moneypunct_wf
;
179 typedef char fake_money_get_w
[sizeof(money_get
<wchar_t>)]
180 __attribute__ ((aligned(__alignof__(money_get
<wchar_t>))));
181 fake_money_get_w money_get_w
;
183 typedef char fake_money_put_w
[sizeof(money_put
<wchar_t>)]
184 __attribute__ ((aligned(__alignof__(money_put
<wchar_t>))));
185 fake_money_put_w money_put_w
;
187 typedef char fake_timepunct_w
[sizeof(__timepunct
<wchar_t>)]
188 __attribute__ ((aligned(__alignof__(__timepunct
<wchar_t>))));
189 fake_timepunct_w timepunct_w
;
191 typedef char fake_time_get_w
[sizeof(time_get
<wchar_t>)]
192 __attribute__ ((aligned(__alignof__(time_get
<wchar_t>))));
193 fake_time_get_w time_get_w
;
195 typedef char fake_time_put_w
[sizeof(time_put
<wchar_t>)]
196 __attribute__ ((aligned(__alignof__(time_put
<wchar_t>))));
197 fake_time_put_w time_put_w
;
199 typedef char fake_messages_w
[sizeof(messages
<wchar_t>)]
200 __attribute__ ((aligned(__alignof__(messages
<wchar_t>))));
201 fake_messages_w messages_w
;
204 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
205 typedef char fake_codecvt_c16
[sizeof(codecvt
<char16_t
, char, mbstate_t>)]
206 __attribute__ ((aligned(__alignof__(codecvt
<char16_t
, char, mbstate_t>))));
207 fake_codecvt_c16 codecvt_c16
;
209 typedef char fake_codecvt_c32
[sizeof(codecvt
<char32_t
, char, mbstate_t>)]
210 __attribute__ ((aligned(__alignof__(codecvt
<char32_t
, char, mbstate_t>))));
211 fake_codecvt_c32 codecvt_c32
;
214 // Storage for "C" locale caches.
215 typedef char fake_num_cache_c
[sizeof(std::__numpunct_cache
<char>)]
216 __attribute__ ((aligned(__alignof__(std::__numpunct_cache
<char>))));
217 fake_num_cache_c numpunct_cache_c
;
219 typedef char fake_money_cache_c
[sizeof(std::__moneypunct_cache
<char, true>)]
220 __attribute__ ((aligned(__alignof__(std::__moneypunct_cache
<char, true>))));
221 fake_money_cache_c moneypunct_cache_ct
;
222 fake_money_cache_c moneypunct_cache_cf
;
224 typedef char fake_time_cache_c
[sizeof(std::__timepunct_cache
<char>)]
225 __attribute__ ((aligned(__alignof__(std::__timepunct_cache
<char>))));
226 fake_time_cache_c timepunct_cache_c
;
228 #ifdef _GLIBCXX_USE_WCHAR_T
229 typedef char fake_num_cache_w
[sizeof(std::__numpunct_cache
<wchar_t>)]
230 __attribute__ ((aligned(__alignof__(std::__numpunct_cache
<wchar_t>))));
231 fake_num_cache_w numpunct_cache_w
;
233 typedef char fake_money_cache_w
[sizeof(std::__moneypunct_cache
<wchar_t,true>)]
234 __attribute__ ((aligned(__alignof__(std::__moneypunct_cache
<wchar_t,true>))));
235 fake_money_cache_w moneypunct_cache_wt
;
236 fake_money_cache_w moneypunct_cache_wf
;
238 typedef char fake_time_cache_w
[sizeof(std::__timepunct_cache
<wchar_t>)]
239 __attribute__ ((aligned(__alignof__(std::__timepunct_cache
<wchar_t>))));
240 fake_time_cache_w timepunct_cache_w
;
242 } // anonymous namespace
244 namespace std
_GLIBCXX_VISIBILITY(default)
246 _GLIBCXX_BEGIN_NAMESPACE_VERSION
248 locale::locale() throw() : _M_impl(0)
252 // Checked locking to optimize the common case where _S_global
253 // still points to _S_classic (locale::_S_initialize_once()):
254 // - If they are the same, just increment the reference count and
255 // we are done. This effectively constructs a C locale object
256 // identical to the static c_locale.
257 // - Otherwise, _S_global can and may be destroyed due to
258 // locale::global() call on another thread, in which case we
259 // fall back to lock protected access to both _S_global and
260 // its reference count.
262 if (_M_impl
== _S_classic
)
263 _M_impl
->_M_add_reference();
266 __gnu_cxx::__scoped_lock
sentry(get_locale_mutex());
267 _S_global
->_M_add_reference();
273 locale::global(const locale
& __other
)
278 __gnu_cxx::__scoped_lock
sentry(get_locale_mutex());
280 __other
._M_impl
->_M_add_reference();
281 _S_global
= __other
._M_impl
;
282 const string __other_name
= __other
.name();
283 if (__other_name
!= "*")
284 setlocale(LC_ALL
, __other_name
.c_str());
287 // Reference count sanity check: one reference removed for the
288 // subsition of __other locale, one added by return-by-value. Net
289 // difference: zero. When the returned locale object's destrutor
290 // is called, then the reference count is decremented and possibly
292 return locale(__old
);
299 return *(new (&c_locale
) locale(_S_classic
));
303 locale::_S_initialize_once() throw()
306 // One reference for _S_classic, one for _S_global
307 _S_classic
= new (&c_locale_impl
) _Impl(2);
308 _S_global
= _S_classic
;
312 locale::_S_initialize()
315 if (__gthread_active_p())
316 __gthread_once(&_S_once
, _S_initialize_once
);
319 _S_initialize_once();
322 // Definitions for static const data members of locale::_Impl
323 const locale::id
* const
324 locale::_Impl::_S_id_ctype
[] =
326 &std::ctype
<char>::id
,
327 &codecvt
<char, char, mbstate_t>::id
,
328 #ifdef _GLIBCXX_USE_WCHAR_T
329 &std::ctype
<wchar_t>::id
,
330 &codecvt
<wchar_t, char, mbstate_t>::id
,
332 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
333 &codecvt
<char16_t
, char, mbstate_t>::id
,
334 &codecvt
<char32_t
, char, mbstate_t>::id
,
339 const locale::id
* const
340 locale::_Impl::_S_id_numeric
[] =
345 #ifdef _GLIBCXX_USE_WCHAR_T
346 &num_get
<wchar_t>::id
,
347 &num_put
<wchar_t>::id
,
348 &numpunct
<wchar_t>::id
,
353 const locale::id
* const
354 locale::_Impl::_S_id_collate
[] =
356 &std::collate
<char>::id
,
357 #ifdef _GLIBCXX_USE_WCHAR_T
358 &std::collate
<wchar_t>::id
,
363 const locale::id
* const
364 locale::_Impl::_S_id_time
[] =
366 &__timepunct
<char>::id
,
369 #ifdef _GLIBCXX_USE_WCHAR_T
370 &__timepunct
<wchar_t>::id
,
371 &time_get
<wchar_t>::id
,
372 &time_put
<wchar_t>::id
,
377 const locale::id
* const
378 locale::_Impl::_S_id_monetary
[] =
380 &money_get
<char>::id
,
381 &money_put
<char>::id
,
382 &moneypunct
<char, false>::id
,
383 &moneypunct
<char, true >::id
,
384 #ifdef _GLIBCXX_USE_WCHAR_T
385 &money_get
<wchar_t>::id
,
386 &money_put
<wchar_t>::id
,
387 &moneypunct
<wchar_t, false>::id
,
388 &moneypunct
<wchar_t, true >::id
,
393 const locale::id
* const
394 locale::_Impl::_S_id_messages
[] =
396 &std::messages
<char>::id
,
397 #ifdef _GLIBCXX_USE_WCHAR_T
398 &std::messages
<wchar_t>::id
,
403 const locale::id
* const* const
404 locale::_Impl::_S_facet_categories
[] =
406 // Order must match the decl order in class locale.
407 locale::_Impl::_S_id_ctype
,
408 locale::_Impl::_S_id_numeric
,
409 locale::_Impl::_S_id_collate
,
410 locale::_Impl::_S_id_time
,
411 locale::_Impl::_S_id_monetary
,
412 locale::_Impl::_S_id_messages
,
416 #if _GLIBCXX_USE_DUAL_ABI
417 // Facets that are instantiated for both the COW and SSO std::string ABIs.
418 // The COW ABI version must come first, followed by its SSO twin.
419 const locale::id
* const locale::_S_twinned_facets
[] = {
420 &::_ZNSt8numpunctIcE2idE
,
422 &::_ZNSt7collateIcE2idE
,
423 &std::collate
<char>::id
,
424 &::_ZNSt8time_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE
,
426 &::_ZNSt9money_getIcSt19istreambuf_iteratorIcSt11char_traitsIcEEE2idE
,
427 &money_get
<char>::id
,
428 &::_ZNSt9money_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE2idE
,
429 &money_put
<char>::id
,
430 &::_ZNSt10moneypunctIcLb0EE2idE
,
431 &moneypunct
<char, false>::id
,
432 &::_ZNSt10moneypunctIcLb1EE2idE
,
433 &moneypunct
<char, true >::id
,
434 &::_ZNSt8messagesIcE2idE
,
435 &std::messages
<char>::id
,
436 # ifdef _GLIBCXX_USE_WCHAR_T
437 &::_ZNSt8numpunctIwE2idE
,
438 &numpunct
<wchar_t>::id
,
439 &::_ZNSt7collateIwE2idE
,
440 &std::collate
<wchar_t>::id
,
441 &::_ZNSt8time_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE
,
442 &time_get
<wchar_t>::id
,
443 &::_ZNSt9money_getIwSt19istreambuf_iteratorIwSt11char_traitsIwEEE2idE
,
444 &money_get
<wchar_t>::id
,
445 &::_ZNSt9money_putIwSt19ostreambuf_iteratorIwSt11char_traitsIwEEE2idE
,
446 &money_put
<wchar_t>::id
,
447 &::_ZNSt10moneypunctIwLb0EE2idE
,
448 &moneypunct
<wchar_t, false>::id
,
449 &::_ZNSt10moneypunctIwLb1EE2idE
,
450 &moneypunct
<wchar_t, true >::id
,
451 &::_ZNSt8messagesIwE2idE
,
452 &std::messages
<wchar_t>::id
,
458 // Construct "C" _Impl.
460 _Impl(size_t __refs
) throw()
461 : _M_refcount(__refs
), _M_facets(0), _M_facets_size(num_facets
),
462 _M_caches(0), _M_names(0)
464 _M_facets
= new (&facet_vec
) const facet
*[_M_facets_size
]();
465 _M_caches
= new (&cache_vec
) const facet
*[_M_facets_size
]();
467 // Name the categories.
468 _M_names
= new (&name_vec
) char*[_S_categories_size
]();
469 _M_names
[0] = new (&name_c
[0]) char[2];
470 std::memcpy(_M_names
[0], locale::facet::_S_get_c_name(), 2);
472 // This is needed as presently the C++ version of "C" locales
473 // != data in the underlying locale model for __timepunct,
474 // numpunct, and moneypunct. Also, the "C" locales must be
475 // constructed in a way such that they are pre-allocated.
476 // NB: Set locale::facets(ref) count to one so that each individual
477 // facet is not destroyed when the locale (and thus locale::_Impl) is
479 _M_init_facet(new (&ctype_c
) std::ctype
<char>(0, false, 1));
480 _M_init_facet(new (&codecvt_c
) codecvt
<char, char, mbstate_t>(1));
482 typedef __numpunct_cache
<char> num_cache_c
;
483 num_cache_c
* __npc
= new (&numpunct_cache_c
) num_cache_c(2);
484 _M_init_facet(new (&numpunct_c
) numpunct
<char>(__npc
, 1));
486 _M_init_facet(new (&num_get_c
) num_get
<char>(1));
487 _M_init_facet(new (&num_put_c
) num_put
<char>(1));
488 _M_init_facet(new (&collate_c
) std::collate
<char>(1));
490 typedef __moneypunct_cache
<char, false> money_cache_cf
;
491 typedef __moneypunct_cache
<char, true> money_cache_ct
;
492 money_cache_cf
* __mpcf
= new (&moneypunct_cache_cf
) money_cache_cf(2);
493 _M_init_facet(new (&moneypunct_cf
) moneypunct
<char, false>(__mpcf
, 1));
494 money_cache_ct
* __mpct
= new (&moneypunct_cache_ct
) money_cache_ct(2);
495 _M_init_facet(new (&moneypunct_ct
) moneypunct
<char, true>(__mpct
, 1));
497 _M_init_facet(new (&money_get_c
) money_get
<char>(1));
498 _M_init_facet(new (&money_put_c
) money_put
<char>(1));
500 typedef __timepunct_cache
<char> time_cache_c
;
501 time_cache_c
* __tpc
= new (&timepunct_cache_c
) time_cache_c(2);
502 _M_init_facet(new (&timepunct_c
) __timepunct
<char>(__tpc
, 1));
504 _M_init_facet(new (&time_get_c
) time_get
<char>(1));
505 _M_init_facet(new (&time_put_c
) time_put
<char>(1));
506 _M_init_facet(new (&messages_c
) std::messages
<char>(1));
508 #ifdef _GLIBCXX_USE_WCHAR_T
509 _M_init_facet(new (&ctype_w
) std::ctype
<wchar_t>(1));
510 _M_init_facet(new (&codecvt_w
) codecvt
<wchar_t, char, mbstate_t>(1));
512 typedef __numpunct_cache
<wchar_t> num_cache_w
;
513 num_cache_w
* __npw
= new (&numpunct_cache_w
) num_cache_w(2);
514 _M_init_facet(new (&numpunct_w
) numpunct
<wchar_t>(__npw
, 1));
516 _M_init_facet(new (&num_get_w
) num_get
<wchar_t>(1));
517 _M_init_facet(new (&num_put_w
) num_put
<wchar_t>(1));
518 _M_init_facet(new (&collate_w
) std::collate
<wchar_t>(1));
520 typedef __moneypunct_cache
<wchar_t, false> money_cache_wf
;
521 typedef __moneypunct_cache
<wchar_t, true> money_cache_wt
;
522 money_cache_wf
* __mpwf
= new (&moneypunct_cache_wf
) money_cache_wf(2);
523 _M_init_facet(new (&moneypunct_wf
) moneypunct
<wchar_t, false>(__mpwf
, 1));
524 money_cache_wt
* __mpwt
= new (&moneypunct_cache_wt
) money_cache_wt(2);
525 _M_init_facet(new (&moneypunct_wt
) moneypunct
<wchar_t, true>(__mpwt
, 1));
527 _M_init_facet(new (&money_get_w
) money_get
<wchar_t>(1));
528 _M_init_facet(new (&money_put_w
) money_put
<wchar_t>(1));
530 typedef __timepunct_cache
<wchar_t> time_cache_w
;
531 time_cache_w
* __tpw
= new (&timepunct_cache_w
) time_cache_w(2);
532 _M_init_facet(new (&timepunct_w
) __timepunct
<wchar_t>(__tpw
, 1));
534 _M_init_facet(new (&time_get_w
) time_get
<wchar_t>(1));
535 _M_init_facet(new (&time_put_w
) time_put
<wchar_t>(1));
536 _M_init_facet(new (&messages_w
) std::messages
<wchar_t>(1));
539 #ifdef _GLIBCXX_USE_C99_STDINT_TR1
540 _M_init_facet(new (&codecvt_c16
) codecvt
<char16_t
, char, mbstate_t>(1));
541 _M_init_facet(new (&codecvt_c32
) codecvt
<char32_t
, char, mbstate_t>(1));
544 #if _GLIBCXX_USE_DUAL_ABI
545 facet
* extra
[] = { __npc
, __mpcf
, __mpct
546 # ifdef _GLIBCXX_USE_WCHAR_T
547 , __npw
, __mpwf
, __mpwt
551 _M_init_extra(extra
);
554 // This locale is safe to pre-cache, after all the facets have
555 // been created and installed.
556 _M_caches
[numpunct
<char>::id
._M_id()] = __npc
;
557 _M_caches
[moneypunct
<char, false>::id
._M_id()] = __mpcf
;
558 _M_caches
[moneypunct
<char, true>::id
._M_id()] = __mpct
;
559 _M_caches
[__timepunct
<char>::id
._M_id()] = __tpc
;
560 #ifdef _GLIBCXX_USE_WCHAR_T
561 _M_caches
[numpunct
<wchar_t>::id
._M_id()] = __npw
;
562 _M_caches
[moneypunct
<wchar_t, false>::id
._M_id()] = __mpwf
;
563 _M_caches
[moneypunct
<wchar_t, true>::id
._M_id()] = __mpwt
;
564 _M_caches
[__timepunct
<wchar_t>::id
._M_id()] = __tpw
;
568 _GLIBCXX_END_NAMESPACE_VERSION