[libc++] Make bsd_locale_fallbacks.h modular and move it into __locale/locale_base_api/

This is a first step towards granularizing `<locale>`.

Reviewed By: ldionne, #libc

Spies: arichardson, libcxx-commits, mikhail.ramalho

Differential Revision: https://reviews.llvm.org/D146397
This commit is contained in:
Nikolas Klauser 2023-03-04 02:37:37 +01:00
parent 596d87c4cc
commit c847b8e24c
20 changed files with 178 additions and 75 deletions

View File

@ -222,8 +222,6 @@ set(files
__bit/popcount.h
__bit/rotate.h
__bit_reference
__bsd_locale_defaults.h
__bsd_locale_fallbacks.h
__charconv/chars_format.h
__charconv/from_chars_integral.h
__charconv/from_chars_result.h
@ -439,6 +437,9 @@ set(files
__iterator/unreachable_sentinel.h
__iterator/wrap_iter.h
__locale
__locale_dir/locale_base_api/bsd_locale_defaults.h
__locale_dir/locale_base_api/bsd_locale_fallbacks.h
__locale_dir/locale_base_api/locale_guard.h
__mbstate_t.h
__memory/addressof.h
__memory/align.h

View File

@ -13,9 +13,9 @@
#include <__availability>
#include <__config>
#include <cctype>
#include <clocale>
#include <cstdint>
#include <cstdlib>
#include <locale.h>
#include <mutex>
#include <string>
@ -23,6 +23,10 @@
#include <cstddef>
#include <cstring>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
#endif
#if defined(_LIBCPP_MSVCRT_LIKE)
# include <__support/win32/locale_win32.h>
#elif defined(_AIX) || defined(__MVS__)
@ -53,63 +57,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS)
struct __libcpp_locale_guard {
_LIBCPP_INLINE_VISIBILITY
__libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
_LIBCPP_INLINE_VISIBILITY
~__libcpp_locale_guard() {
if (__old_loc_)
uselocale(__old_loc_);
}
locale_t __old_loc_;
private:
__libcpp_locale_guard(__libcpp_locale_guard const&);
__libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
};
#elif defined(_LIBCPP_MSVCRT_LIKE)
struct __libcpp_locale_guard {
__libcpp_locale_guard(locale_t __l) :
__status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
// Setting the locale can be expensive even when the locale given is
// already the current locale, so do an explicit check to see if the
// current locale is already the one we want.
const char* __lc = __setlocale(nullptr);
// If every category is the same, the locale string will simply be the
// locale name, otherwise it will be a semicolon-separated string listing
// each category. In the second case, we know at least one category won't
// be what we want, so we only have to check the first case.
if (_VSTD::strcmp(__l.__get_locale(), __lc) != 0) {
__locale_all = _strdup(__lc);
if (__locale_all == nullptr)
__throw_bad_alloc();
__setlocale(__l.__get_locale());
}
}
~__libcpp_locale_guard() {
// The CRT documentation doesn't explicitly say, but setlocale() does the
// right thing when given a semicolon-separated list of locale settings
// for the different categories in the same format as returned by
// setlocale(LC_ALL, nullptr).
if (__locale_all != nullptr) {
__setlocale(__locale_all);
free(__locale_all);
}
_configthreadlocale(__status);
}
static const char* __setlocale(const char* __locale) {
const char* __new_locale = setlocale(LC_ALL, __locale);
if (__new_locale == nullptr)
__throw_bad_alloc();
return __new_locale;
}
int __status;
char* __locale_all = nullptr;
};
#endif
class _LIBCPP_TYPE_VIS locale;
template <class _Facet>

View File

@ -11,8 +11,8 @@
// we will define the mapping from an internal macro to the real BSD symbol.
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___BSD_LOCALE_DEFAULTS_H
#define _LIBCPP___BSD_LOCALE_DEFAULTS_H
#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_DEFAULTS_H
#define _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_DEFAULTS_H
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@ -33,4 +33,4 @@
#define __libcpp_asprintf_l(...) asprintf_l(__VA_ARGS__)
#define __libcpp_sscanf_l(...) sscanf_l(__VA_ARGS__)
#endif // _LIBCPP___BSD_LOCALE_DEFAULTS_H
#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_DEFAULTS_H

View File

@ -10,12 +10,18 @@
// of those functions for non-BSD platforms.
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___BSD_LOCALE_FALLBACKS_H
#define _LIBCPP___BSD_LOCALE_FALLBACKS_H
#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_FALLBACKS_H
#define _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_FALLBACKS_H
#include <__locale_dir/locale_base_api/locale_guard.h>
#include <cstdio>
#include <stdarg.h>
#include <stdlib.h>
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
# include <cwchar>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
@ -139,4 +145,4 @@ int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___BSD_LOCALE_FALLBACKS_H
#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_BSD_LOCALE_FALLBACKS_H

View File

@ -0,0 +1,79 @@
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP___LOCALE_LOCALE_BASE_API_LOCALE_GUARD_H
#define _LIBCPP___LOCALE_LOCALE_BASE_API_LOCALE_GUARD_H
#include <__config>
#include <clocale>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS)
struct __libcpp_locale_guard {
_LIBCPP_INLINE_VISIBILITY __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
_LIBCPP_INLINE_VISIBILITY ~__libcpp_locale_guard() {
if (__old_loc_)
uselocale(__old_loc_);
}
locale_t __old_loc_;
private:
__libcpp_locale_guard(__libcpp_locale_guard const&);
__libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
};
#elif defined(_LIBCPP_MSVCRT_LIKE)
struct __libcpp_locale_guard {
__libcpp_locale_guard(locale_t __l) :
__status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)) {
// Setting the locale can be expensive even when the locale given is
// already the current locale, so do an explicit check to see if the
// current locale is already the one we want.
const char* __lc = __setlocale(nullptr);
// If every category is the same, the locale string will simply be the
// locale name, otherwise it will be a semicolon-separated string listing
// each category. In the second case, we know at least one category won't
// be what we want, so we only have to check the first case.
if (_VSTD::strcmp(__l.__get_locale(), __lc) != 0) {
__locale_all = _strdup(__lc);
if (__locale_all == nullptr)
__throw_bad_alloc();
__setlocale(__l.__get_locale());
}
}
~__libcpp_locale_guard() {
// The CRT documentation doesn't explicitly say, but setlocale() does the
// right thing when given a semicolon-separated list of locale settings
// for the different categories in the same format as returned by
// setlocale(LC_ALL, nullptr).
if (__locale_all != nullptr) {
__setlocale(__locale_all);
free(__locale_all);
}
_configthreadlocale(__status);
}
static const char* __setlocale(const char* __locale) {
const char* __new_locale = setlocale(LC_ALL, __locale);
if (__new_locale == nullptr)
__throw_bad_alloc();
return __new_locale;
}
int __status;
char* __locale_all = nullptr;
};
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP___LOCALE_LOCALE_BASE_API_LOCALE_GUARD_H

View File

@ -32,6 +32,7 @@
{ include: [ "@<__fwd/.*>", "private", "<fwd>", "public" ] },
{ include: [ "@<__ios/.*>", "private", "<ios>", "public" ] },
{ include: [ "@<__iterator/.*>", "private", "<iterator>", "public" ] },
{ include: [ "@<__locale_dir/.*>", "private", "<locale>", "public" ] },
{ include: [ "@<__memory/.*>", "private", "<memory>", "public" ] },
{ include: [ "@<__memory_resource/.*>", "private", "<memory_resource>", "public" ] },
{ include: [ "@<__mutex/.*>", "private", "<mutex>", "public" ] },

View File

@ -225,9 +225,9 @@ template <class charT> class messages_byname;
#endif
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
#include <__bsd_locale_defaults.h>
# include <__locale_dir/locale_base_api/bsd_locale_defaults.h>
#else
#include <__bsd_locale_fallbacks.h>
# include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

View File

@ -11,6 +11,10 @@
#include <new>
#include <string>
#ifdef _LIBCPP_MSVCRT_LIKE
# include <__locale_dir/locale_base_api/locale_guard.h>
#endif
#define _str(s) #s
#define str(s) _str(s)
#define _LIBCPP_ABI_NAMESPACE_STR str(_LIBCPP_ABI_NAMESPACE)

View File

@ -11,6 +11,8 @@
#include <memory>
#include <type_traits>
#include <__locale_dir/locale_base_api/locale_guard.h>
int __libcpp_vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
using std::__libcpp_locale_guard;

View File

@ -23,7 +23,7 @@ if __name__ == '__main__':
if re.match(r'^\s*module (\w+)\s+[{] private header "\1(.h)?"\s+export [*] [}]', line):
# It's a top-level private header, such as <__bit_reference>.
pass
elif re.match(r'^\s*module (\w+)\s+[{] private header "__\w+/\1[.]h" [}]', line):
elif re.match(r'^\s*module (\w+)\s+[{] private (textual )?header "__(\w+/)*\1[.]h" [}]', line):
# It's a private submodule, such as <__utility/swap.h>.
pass
elif re.match(r'^\s*module (\w+)_fwd\s+[{] private header "__fwd/\1[.]h" [}]', line):

View File

@ -23,6 +23,10 @@ for header in private_headers:
if header.startswith('__support'):
continue
# Skip the locale API headers, since they are platform-specific and thus inherently non-modular
if 'locale_base_api' in header:
continue
print("{ifdef}#{indent}include <{header}> // {expected_error}@*:* {{{{use of private header from outside its module: '{header}'}}}}{endif}".format(
ifdef='#if ' + header_restrictions[header] + '\n' if header in header_restrictions else '',
indent=' ' if header in header_restrictions else '',

View File

@ -127,11 +127,13 @@ cmath type_traits
cmath version
codecvt atomic
codecvt cctype
codecvt clocale
codecvt concepts
codecvt cstddef
codecvt cstdint
codecvt cstdlib
codecvt cstring
codecvt cwchar
codecvt initializer_list
codecvt iosfwd
codecvt limits
@ -354,12 +356,14 @@ forward_list typeinfo
forward_list version
fstream atomic
fstream cctype
fstream clocale
fstream concepts
fstream cstddef
fstream cstdint
fstream cstdio
fstream cstdlib
fstream cstring
fstream cwchar
fstream filesystem
fstream initializer_list
fstream iosfwd
@ -420,11 +424,13 @@ iomanip istream
iomanip version
ios atomic
ios cctype
ios clocale
ios concepts
ios cstddef
ios cstdint
ios cstdlib
ios cstring
ios cwchar
ios initializer_list
ios iosfwd
ios limits
@ -496,6 +502,7 @@ list version
locale atomic
locale cctype
locale cerrno
locale clocale
locale concepts
locale cstdarg
locale cstddef
@ -504,6 +511,7 @@ locale cstdio
locale cstdlib
locale cstring
locale ctime
locale cwchar
locale initializer_list
locale ios
locale iosfwd
@ -681,12 +689,14 @@ ratio type_traits
ratio version
regex atomic
regex cctype
regex clocale
regex compare
regex concepts
regex cstddef
regex cstdint
regex cstdlib
regex cstring
regex cwchar
regex deque
regex initializer_list
regex iosfwd

1 algorithm atomic
127 cmath version
128 codecvt atomic
129 codecvt cctype
130 codecvt clocale
131 codecvt concepts
132 codecvt cstddef
133 codecvt cstdint
134 codecvt cstdlib
135 codecvt cstring
136 codecvt cwchar
137 codecvt initializer_list
138 codecvt iosfwd
139 codecvt limits
356 forward_list version
357 fstream atomic
358 fstream cctype
359 fstream clocale
360 fstream concepts
361 fstream cstddef
362 fstream cstdint
363 fstream cstdio
364 fstream cstdlib
365 fstream cstring
366 fstream cwchar
367 fstream filesystem
368 fstream initializer_list
369 fstream iosfwd
424 iomanip version
425 ios atomic
426 ios cctype
427 ios clocale
428 ios concepts
429 ios cstddef
430 ios cstdint
431 ios cstdlib
432 ios cstring
433 ios cwchar
434 ios initializer_list
435 ios iosfwd
436 ios limits
502 locale atomic
503 locale cctype
504 locale cerrno
505 locale clocale
506 locale concepts
507 locale cstdarg
508 locale cstddef
511 locale cstdlib
512 locale cstring
513 locale ctime
514 locale cwchar
515 locale initializer_list
516 locale ios
517 locale iosfwd
689 ratio version
690 regex atomic
691 regex cctype
692 regex clocale
693 regex compare
694 regex concepts
695 regex cstddef
696 regex cstdint
697 regex cstdlib
698 regex cstring
699 regex cwchar
700 regex deque
701 regex initializer_list
702 regex iosfwd

View File

@ -127,11 +127,13 @@ cmath type_traits
cmath version
codecvt atomic
codecvt cctype
codecvt clocale
codecvt concepts
codecvt cstddef
codecvt cstdint
codecvt cstdlib
codecvt cstring
codecvt cwchar
codecvt initializer_list
codecvt iosfwd
codecvt limits
@ -354,12 +356,14 @@ forward_list typeinfo
forward_list version
fstream atomic
fstream cctype
fstream clocale
fstream concepts
fstream cstddef
fstream cstdint
fstream cstdio
fstream cstdlib
fstream cstring
fstream cwchar
fstream filesystem
fstream initializer_list
fstream iosfwd
@ -420,11 +424,13 @@ iomanip istream
iomanip version
ios atomic
ios cctype
ios clocale
ios concepts
ios cstddef
ios cstdint
ios cstdlib
ios cstring
ios cwchar
ios initializer_list
ios iosfwd
ios limits
@ -496,6 +502,7 @@ list version
locale atomic
locale cctype
locale cerrno
locale clocale
locale concepts
locale cstdarg
locale cstddef
@ -504,6 +511,7 @@ locale cstdio
locale cstdlib
locale cstring
locale ctime
locale cwchar
locale initializer_list
locale ios
locale iosfwd
@ -682,12 +690,14 @@ ratio type_traits
ratio version
regex atomic
regex cctype
regex clocale
regex compare
regex concepts
regex cstddef
regex cstdint
regex cstdlib
regex cstring
regex cwchar
regex deque
regex initializer_list
regex iosfwd

1 algorithm atomic
127 cmath version
128 codecvt atomic
129 codecvt cctype
130 codecvt clocale
131 codecvt concepts
132 codecvt cstddef
133 codecvt cstdint
134 codecvt cstdlib
135 codecvt cstring
136 codecvt cwchar
137 codecvt initializer_list
138 codecvt iosfwd
139 codecvt limits
356 forward_list version
357 fstream atomic
358 fstream cctype
359 fstream clocale
360 fstream concepts
361 fstream cstddef
362 fstream cstdint
363 fstream cstdio
364 fstream cstdlib
365 fstream cstring
366 fstream cwchar
367 fstream filesystem
368 fstream initializer_list
369 fstream iosfwd
424 iomanip version
425 ios atomic
426 ios cctype
427 ios clocale
428 ios concepts
429 ios cstddef
430 ios cstdint
431 ios cstdlib
432 ios cstring
433 ios cwchar
434 ios initializer_list
435 ios iosfwd
436 ios limits
502 locale atomic
503 locale cctype
504 locale cerrno
505 locale clocale
506 locale concepts
507 locale cstdarg
508 locale cstddef
511 locale cstdlib
512 locale cstring
513 locale ctime
514 locale cwchar
515 locale initializer_list
516 locale ios
517 locale iosfwd
690 ratio version
691 regex atomic
692 regex cctype
693 regex clocale
694 regex compare
695 regex concepts
696 regex cstddef
697 regex cstdint
698 regex cstdlib
699 regex cstring
700 regex cwchar
701 regex deque
702 regex initializer_list
703 regex iosfwd

View File

@ -127,11 +127,13 @@ cmath type_traits
cmath version
codecvt atomic
codecvt cctype
codecvt clocale
codecvt concepts
codecvt cstddef
codecvt cstdint
codecvt cstdlib
codecvt cstring
codecvt cwchar
codecvt initializer_list
codecvt iosfwd
codecvt limits
@ -356,12 +358,14 @@ forward_list typeinfo
forward_list version
fstream atomic
fstream cctype
fstream clocale
fstream concepts
fstream cstddef
fstream cstdint
fstream cstdio
fstream cstdlib
fstream cstring
fstream cwchar
fstream filesystem
fstream initializer_list
fstream iosfwd
@ -422,11 +426,13 @@ iomanip istream
iomanip version
ios atomic
ios cctype
ios clocale
ios concepts
ios cstddef
ios cstdint
ios cstdlib
ios cstring
ios cwchar
ios initializer_list
ios iosfwd
ios limits
@ -498,6 +504,7 @@ list version
locale atomic
locale cctype
locale cerrno
locale clocale
locale concepts
locale cstdarg
locale cstddef
@ -506,6 +513,7 @@ locale cstdio
locale cstdlib
locale cstring
locale ctime
locale cwchar
locale initializer_list
locale ios
locale iosfwd
@ -684,12 +692,14 @@ ratio type_traits
ratio version
regex atomic
regex cctype
regex clocale
regex compare
regex concepts
regex cstddef
regex cstdint
regex cstdlib
regex cstring
regex cwchar
regex deque
regex initializer_list
regex iosfwd

1 algorithm atomic
127 cmath version
128 codecvt atomic
129 codecvt cctype
130 codecvt clocale
131 codecvt concepts
132 codecvt cstddef
133 codecvt cstdint
134 codecvt cstdlib
135 codecvt cstring
136 codecvt cwchar
137 codecvt initializer_list
138 codecvt iosfwd
139 codecvt limits
358 forward_list version
359 fstream atomic
360 fstream cctype
361 fstream clocale
362 fstream concepts
363 fstream cstddef
364 fstream cstdint
365 fstream cstdio
366 fstream cstdlib
367 fstream cstring
368 fstream cwchar
369 fstream filesystem
370 fstream initializer_list
371 fstream iosfwd
426 iomanip version
427 ios atomic
428 ios cctype
429 ios clocale
430 ios concepts
431 ios cstddef
432 ios cstdint
433 ios cstdlib
434 ios cstring
435 ios cwchar
436 ios initializer_list
437 ios iosfwd
438 ios limits
504 locale atomic
505 locale cctype
506 locale cerrno
507 locale clocale
508 locale concepts
509 locale cstdarg
510 locale cstddef
513 locale cstdlib
514 locale cstring
515 locale ctime
516 locale cwchar
517 locale initializer_list
518 locale ios
519 locale iosfwd
692 ratio version
693 regex atomic
694 regex cctype
695 regex clocale
696 regex compare
697 regex concepts
698 regex cstddef
699 regex cstdint
700 regex cstdlib
701 regex cstring
702 regex cwchar
703 regex deque
704 regex initializer_list
705 regex iosfwd

View File

@ -127,11 +127,13 @@ cmath type_traits
cmath version
codecvt atomic
codecvt cctype
codecvt clocale
codecvt concepts
codecvt cstddef
codecvt cstdint
codecvt cstdlib
codecvt cstring
codecvt cwchar
codecvt initializer_list
codecvt iosfwd
codecvt limits
@ -356,12 +358,14 @@ forward_list typeinfo
forward_list version
fstream atomic
fstream cctype
fstream clocale
fstream concepts
fstream cstddef
fstream cstdint
fstream cstdio
fstream cstdlib
fstream cstring
fstream cwchar
fstream filesystem
fstream initializer_list
fstream iosfwd
@ -422,11 +426,13 @@ iomanip istream
iomanip version
ios atomic
ios cctype
ios clocale
ios concepts
ios cstddef
ios cstdint
ios cstdlib
ios cstring
ios cwchar
ios initializer_list
ios iosfwd
ios limits
@ -498,6 +504,7 @@ list version
locale atomic
locale cctype
locale cerrno
locale clocale
locale concepts
locale cstdarg
locale cstddef
@ -506,6 +513,7 @@ locale cstdio
locale cstdlib
locale cstring
locale ctime
locale cwchar
locale initializer_list
locale ios
locale iosfwd
@ -684,12 +692,14 @@ ratio type_traits
ratio version
regex atomic
regex cctype
regex clocale
regex compare
regex concepts
regex cstddef
regex cstdint
regex cstdlib
regex cstring
regex cwchar
regex deque
regex initializer_list
regex iosfwd

1 algorithm atomic
127 cmath version
128 codecvt atomic
129 codecvt cctype
130 codecvt clocale
131 codecvt concepts
132 codecvt cstddef
133 codecvt cstdint
134 codecvt cstdlib
135 codecvt cstring
136 codecvt cwchar
137 codecvt initializer_list
138 codecvt iosfwd
139 codecvt limits
358 forward_list version
359 fstream atomic
360 fstream cctype
361 fstream clocale
362 fstream concepts
363 fstream cstddef
364 fstream cstdint
365 fstream cstdio
366 fstream cstdlib
367 fstream cstring
368 fstream cwchar
369 fstream filesystem
370 fstream initializer_list
371 fstream iosfwd
426 iomanip version
427 ios atomic
428 ios cctype
429 ios clocale
430 ios concepts
431 ios cstddef
432 ios cstdint
433 ios cstdlib
434 ios cstring
435 ios cwchar
436 ios initializer_list
437 ios iosfwd
438 ios limits
504 locale atomic
505 locale cctype
506 locale cerrno
507 locale clocale
508 locale concepts
509 locale cstdarg
510 locale cstddef
513 locale cstdlib
514 locale cstring
515 locale ctime
516 locale cwchar
517 locale initializer_list
518 locale ios
519 locale iosfwd
692 ratio version
693 regex atomic
694 regex cctype
695 regex clocale
696 regex compare
697 regex concepts
698 regex cstddef
699 regex cstdint
700 regex cstdlib
701 regex cstring
702 regex cwchar
703 regex deque
704 regex initializer_list
705 regex iosfwd

View File

@ -134,11 +134,13 @@ cmath type_traits
cmath version
codecvt atomic
codecvt cctype
codecvt clocale
codecvt concepts
codecvt cstddef
codecvt cstdint
codecvt cstdlib
codecvt cstring
codecvt cwchar
codecvt initializer_list
codecvt iosfwd
codecvt limits
@ -363,12 +365,14 @@ forward_list typeinfo
forward_list version
fstream atomic
fstream cctype
fstream clocale
fstream concepts
fstream cstddef
fstream cstdint
fstream cstdio
fstream cstdlib
fstream cstring
fstream cwchar
fstream filesystem
fstream initializer_list
fstream iosfwd
@ -428,11 +432,13 @@ iomanip istream
iomanip version
ios atomic
ios cctype
ios clocale
ios concepts
ios cstddef
ios cstdint
ios cstdlib
ios cstring
ios cwchar
ios initializer_list
ios iosfwd
ios limits
@ -504,6 +510,7 @@ list version
locale atomic
locale cctype
locale cerrno
locale clocale
locale concepts
locale cstdarg
locale cstddef
@ -512,6 +519,7 @@ locale cstdio
locale cstdlib
locale cstring
locale ctime
locale cwchar
locale initializer_list
locale ios
locale iosfwd
@ -690,12 +698,14 @@ ratio type_traits
ratio version
regex atomic
regex cctype
regex clocale
regex compare
regex concepts
regex cstddef
regex cstdint
regex cstdlib
regex cstring
regex cwchar
regex deque
regex initializer_list
regex iosfwd

1 algorithm atomic
134 cmath version
135 codecvt atomic
136 codecvt cctype
137 codecvt clocale
138 codecvt concepts
139 codecvt cstddef
140 codecvt cstdint
141 codecvt cstdlib
142 codecvt cstring
143 codecvt cwchar
144 codecvt initializer_list
145 codecvt iosfwd
146 codecvt limits
365 forward_list version
366 fstream atomic
367 fstream cctype
368 fstream clocale
369 fstream concepts
370 fstream cstddef
371 fstream cstdint
372 fstream cstdio
373 fstream cstdlib
374 fstream cstring
375 fstream cwchar
376 fstream filesystem
377 fstream initializer_list
378 fstream iosfwd
432 iomanip version
433 ios atomic
434 ios cctype
435 ios clocale
436 ios concepts
437 ios cstddef
438 ios cstdint
439 ios cstdlib
440 ios cstring
441 ios cwchar
442 ios initializer_list
443 ios iosfwd
444 ios limits
510 locale atomic
511 locale cctype
512 locale cerrno
513 locale clocale
514 locale concepts
515 locale cstdarg
516 locale cstddef
519 locale cstdlib
520 locale cstring
521 locale ctime
522 locale cwchar
523 locale initializer_list
524 locale ios
525 locale iosfwd
698 ratio version
699 regex atomic
700 regex cctype
701 regex clocale
702 regex compare
703 regex concepts
704 regex cstddef
705 regex cstdint
706 regex cstdlib
707 regex cstring
708 regex cwchar
709 regex deque
710 regex initializer_list
711 regex iosfwd

View File

@ -84,10 +84,12 @@ chrono version
cinttypes cstdint
cmath version
codecvt cctype
codecvt clocale
codecvt cstddef
codecvt cstdint
codecvt cstdlib
codecvt cstring
codecvt cwchar
codecvt mutex
codecvt string
codecvt version
@ -242,11 +244,13 @@ forward_list stdexcept
forward_list tuple
forward_list version
fstream cctype
fstream clocale
fstream cstddef
fstream cstdint
fstream cstdio
fstream cstdlib
fstream cstring
fstream cwchar
fstream filesystem
fstream initializer_list
fstream istream
@ -290,10 +294,12 @@ initializer_list cstddef
iomanip istream
iomanip version
ios cctype
ios clocale
ios cstddef
ios cstdint
ios cstdlib
ios cstring
ios cwchar
ios iosfwd
ios mutex
ios string
@ -337,12 +343,14 @@ list tuple
list version
locale cctype
locale cerrno
locale clocale
locale cstddef
locale cstdint
locale cstdio
locale cstdlib
locale cstring
locale ctime
locale cwchar
locale initializer_list
locale ios
locale iosfwd
@ -460,11 +468,13 @@ ratio climits
ratio cstdint
ratio version
regex cctype
regex clocale
regex compare
regex cstddef
regex cstdint
regex cstdlib
regex cstring
regex cwchar
regex deque
regex initializer_list
regex limits

1 algorithm climits
84 cinttypes cstdint
85 cmath version
86 codecvt cctype
87 codecvt clocale
88 codecvt cstddef
89 codecvt cstdint
90 codecvt cstdlib
91 codecvt cstring
92 codecvt cwchar
93 codecvt mutex
94 codecvt string
95 codecvt version
244 forward_list tuple
245 forward_list version
246 fstream cctype
247 fstream clocale
248 fstream cstddef
249 fstream cstdint
250 fstream cstdio
251 fstream cstdlib
252 fstream cstring
253 fstream cwchar
254 fstream filesystem
255 fstream initializer_list
256 fstream istream
294 iomanip istream
295 iomanip version
296 ios cctype
297 ios clocale
298 ios cstddef
299 ios cstdint
300 ios cstdlib
301 ios cstring
302 ios cwchar
303 ios iosfwd
304 ios mutex
305 ios string
343 list version
344 locale cctype
345 locale cerrno
346 locale clocale
347 locale cstddef
348 locale cstdint
349 locale cstdio
350 locale cstdlib
351 locale cstring
352 locale ctime
353 locale cwchar
354 locale initializer_list
355 locale ios
356 locale iosfwd
468 ratio cstdint
469 ratio version
470 regex cctype
471 regex clocale
472 regex compare
473 regex cstddef
474 regex cstdint
475 regex cstdlib
476 regex cstring
477 regex cwchar
478 regex deque
479 regex initializer_list
480 regex limits

View File

@ -236,8 +236,6 @@ libcxx/include/__bit/popcount.h
libcxx/include/__bit_reference
libcxx/include/__bit/rotate.h
libcxx/include/bitset
libcxx/include/__bsd_locale_defaults.h
libcxx/include/__bsd_locale_fallbacks.h
libcxx/include/cctype
libcxx/include/chrono
libcxx/include/__chrono/calendar.h
@ -455,6 +453,9 @@ libcxx/include/limits.h
libcxx/include/list
libcxx/include/__locale
libcxx/include/locale
libcxx/include/__locale_dir/locale_base_api/bsd_locale_defaults.h
libcxx/include/__locale_dir/locale_base_api/bsd_locale_fallbacks.h
libcxx/include/__locale_dir/locale_base_api/locale_guard.h
libcxx/include/locale.h
libcxx/include/map
libcxx/include/math.h

View File

@ -64,7 +64,7 @@ header_restrictions = {
}
private_headers_still_public_in_modules = [
'__assert', '__bsd_locale_defaults.h', '__bsd_locale_fallbacks.h', '__config',
'__assert', '__config',
'__config_site.in', '__debug', '__hash_table',
'__threading_support', '__tree', '__undef_macros', '__verbose_abort'
]

View File

@ -30,7 +30,7 @@ def generate_map(include):
c_headers.append(i.name)
result = []
temporary_mappings = {}
temporary_mappings = {'__locale_dir' : 'locale'}
for i in detail_directories:
public_header = temporary_mappings.get(i, i.lstrip('_'))
result.append(f'{generate(f"@<{i}/.*>", public_header)},')
@ -41,8 +41,6 @@ def generate_map(include):
elif i == '__availability': continue
elif i == '__bit_reference': continue
elif i == '__bits': public = ['bits']
elif i == '__bsd_locale_defaults.h': continue
elif i == '__bsd_locale_fallbacks.h': continue
elif i == '__config_site.in': continue
elif i == '__config': continue
elif i == '__debug': continue