Skip to content

Commit 9082306

Browse files
committed
[libc++] Fix locale-related compilation errors on NetBSD
To my knowledge, NetBSD is mostly like other BSDs, but doesn't have xlocale.h. I think c664a7f may have inadvertently broken this.
1 parent 4fb81f1 commit 9082306

File tree

5 files changed

+27
-1
lines changed

5 files changed

+27
-1
lines changed

libcxx/include/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ set(files
522522
__locale_dir/support/freebsd.h
523523
__locale_dir/support/fuchsia.h
524524
__locale_dir/support/linux.h
525+
__locale_dir/support/netbsd.h
525526
__locale_dir/support/no_locale/characters.h
526527
__locale_dir/support/no_locale/strtonum.h
527528
__locale_dir/support/windows.h

libcxx/include/__locale_dir/locale_base_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@
117117
# include <__locale_dir/support/apple.h>
118118
# elif defined(__FreeBSD__)
119119
# include <__locale_dir/support/freebsd.h>
120+
# elif defined(__NetBSD__)
121+
# include <__locale_dir/support/netbsd.h>
120122
# elif defined(_LIBCPP_MSVCRT_LIKE)
121123
# include <__locale_dir/support/windows.h>
122124
# elif defined(__Fuchsia__)

libcxx/include/__locale_dir/support/bsd_like.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
# include <wctype.h>
2525
#endif
2626

27-
#include <xlocale.h>
27+
#if __has_include(<xlocale.h>)
28+
# include <xlocale.h>
29+
#endif
2830

2931
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3032
# pragma GCC system_header
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//===-----------------------------------------------------------------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
10+
#define _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
11+
12+
#include <__config>
13+
14+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
15+
# pragma GCC system_header
16+
#endif
17+
18+
#include <__locale_dir/support/bsd_like.h>
19+
20+
#endif // _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H

libcxx/include/module.modulemap.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,6 +1567,7 @@ module std [system] {
15671567
textual header "__locale_dir/support/freebsd.h"
15681568
textual header "__locale_dir/support/fuchsia.h"
15691569
textual header "__locale_dir/support/linux.h"
1570+
textual header "__locale_dir/support/netbsd.h"
15701571
textual header "__locale_dir/support/no_locale/characters.h"
15711572
textual header "__locale_dir/support/no_locale/strtonum.h"
15721573
textual header "__locale_dir/support/windows.h"

0 commit comments

Comments
 (0)