Commit b6d9046242

Alex Rønne Petersen <alex@alexrp.com>
2025-06-06 03:14:03
libcxx: Fix locale-related compilation errors on NetBSD.
llvm/llvm-project#143055
1 parent 98cf81d
Changed files (5)
lib
libcxx
lib/libcxx/include/__locale_dir/support/apple.h
@@ -15,6 +15,8 @@
 #  pragma GCC system_header
 #endif
 
+#include <xlocale.h>
+
 #include <__locale_dir/support/bsd_like.h>
 
 #endif // _LIBCPP___LOCALE_DIR_SUPPORT_APPLE_H
lib/libcxx/include/__locale_dir/support/bsd_like.h
@@ -24,8 +24,6 @@
 #  include <wctype.h>
 #endif
 
-#include <xlocale.h>
-
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
lib/libcxx/include/__locale_dir/support/freebsd.h
@@ -15,6 +15,8 @@
 #  pragma GCC system_header
 #endif
 
+#include <xlocale.h>
+
 #include <__locale_dir/support/bsd_like.h>
 
 #endif // _LIBCPP___LOCALE_DIR_SUPPORT_FREEBSD_H
lib/libcxx/include/__locale_dir/support/netbsd.h
@@ -0,0 +1,20 @@
+//===-----------------------------------------------------------------------===//
+//
+// 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_DIR_SUPPORT_NETBSD_H
+#define _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#include <__locale_dir/support/bsd_like.h>
+
+#endif // _LIBCPP___LOCALE_DIR_SUPPORT_NETBSD_H
lib/libcxx/include/__locale_dir/locale_base_api.h
@@ -115,6 +115,8 @@
 #  include <__locale_dir/support/apple.h>
 #elif defined(__FreeBSD__)
 #  include <__locale_dir/support/freebsd.h>
+#elif defined(__NetBSD__)
+#  include <__locale_dir/support/netbsd.h>
 #elif defined(_LIBCPP_MSVCRT_LIKE)
 #  include <__locale_dir/support/windows.h>
 #elif defined(__Fuchsia__)