Skip to content

Commit e146c18

Browse files
authored
[libc++] Split Apple and Freebsd locale support into their own headers (#113737)
For now these headers don't provide much benefit, however as we refactor the locale base API they will provide a location to specify the localization interface on these platforms.
1 parent 0cf7aaf commit e146c18

File tree

5 files changed

+38
-2
lines changed

5 files changed

+38
-2
lines changed

libcxx/include/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -492,8 +492,10 @@ set(files
492492
__locale
493493
__locale_dir/locale_base_api.h
494494
__locale_dir/locale_base_api/android.h
495+
__locale_dir/locale_base_api/apple.h
495496
__locale_dir/locale_base_api/bsd_locale_defaults.h
496497
__locale_dir/locale_base_api/bsd_locale_fallbacks.h
498+
__locale_dir/locale_base_api/freebsd.h
497499
__locale_dir/locale_base_api/fuchsia.h
498500
__locale_dir/locale_base_api/ibm.h
499501
__locale_dir/locale_base_api/musl.h

libcxx/include/__locale_dir/locale_base_api.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121
# include <__locale_dir/locale_base_api/fuchsia.h>
2222
#elif defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
2323
# include <__locale_dir/locale_base_api/musl.h>
24-
#elif defined(__APPLE__) || defined(__FreeBSD__)
25-
# include <xlocale.h>
24+
#elif defined(__APPLE__)
25+
# include <__locale_dir/locale_base_api/apple.h>
26+
#elif defined(__FreeBSD__)
27+
# include <__locale_dir/locale_base_api/freebsd.h>
2628
#endif
2729

2830
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// -*- C++ -*-
2+
//===-----------------------------------------------------------------------===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_APPLE_H
11+
#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_APPLE_H
12+
13+
#include <xlocale.h>
14+
15+
#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_APPLE_H
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// -*- C++ -*-
2+
//===-----------------------------------------------------------------------===//
3+
//
4+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5+
// See https://llvm.org/LICENSE.txt for license information.
6+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7+
//
8+
//===----------------------------------------------------------------------===//
9+
10+
#ifndef _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_FREEBSD_H
11+
#define _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_FREEBSD_H
12+
13+
#include <xlocale.h>
14+
15+
#endif // _LIBCPP___LOCALE_DIR_LOCALE_BASE_API_FREEBSD_H

libcxx/include/module.modulemap

+2
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,10 @@ module std [system] {
14461446
header "__locale_dir/locale_guard.h"
14471447
module locale_base_api {
14481448
textual header "__locale_dir/locale_base_api/android.h"
1449+
textual header "__locale_dir/locale_base_api/apple.h"
14491450
textual header "__locale_dir/locale_base_api/bsd_locale_defaults.h"
14501451
textual header "__locale_dir/locale_base_api/bsd_locale_fallbacks.h"
1452+
textual header "__locale_dir/locale_base_api/freebsd.h"
14511453
textual header "__locale_dir/locale_base_api/fuchsia.h"
14521454
textual header "__locale_dir/locale_base_api/ibm.h"
14531455
textual header "__locale_dir/locale_base_api/musl.h"

0 commit comments

Comments
 (0)