Skip to content

Conversation

@philnik777
Copy link
Contributor

There seems to be very little value in having separate headers for the different BSDs, since they all just include another, shared, header.

@philnik777 philnik777 requested a review from a team as a code owner December 3, 2025 10:14
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Dec 3, 2025
@llvmbot
Copy link
Member

llvmbot commented Dec 3, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

There seems to be very little value in having separate headers for the different BSDs, since they all just include another, shared, header.


Full diff: https://github.com/llvm/llvm-project/pull/170452.diff

4 Files Affected:

  • (modified) libcxx/include/__locale_dir/locale_base_api.h (+2-6)
  • (removed) libcxx/include/__locale_dir/support/apple.h (-20)
  • (removed) libcxx/include/__locale_dir/support/freebsd.h (-20)
  • (removed) libcxx/include/__locale_dir/support/netbsd.h (-20)
diff --git a/libcxx/include/__locale_dir/locale_base_api.h b/libcxx/include/__locale_dir/locale_base_api.h
index d26d529d4e0c2..6b10ffb95cd63 100644
--- a/libcxx/include/__locale_dir/locale_base_api.h
+++ b/libcxx/include/__locale_dir/locale_base_api.h
@@ -106,12 +106,8 @@
 
 #if _LIBCPP_HAS_LOCALIZATION
 
-#  if defined(__APPLE__)
-#    include <__locale_dir/support/apple.h>
-#  elif defined(__FreeBSD__)
-#    include <__locale_dir/support/freebsd.h>
-#  elif defined(__NetBSD__)
-#    include <__locale_dir/support/netbsd.h>
+#  if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__)
+#    include <__locale_dir/support/bsd_like.h>
 #  elif defined(_LIBCPP_MSVCRT_LIKE)
 #    include <__locale_dir/support/windows.h>
 #  elif defined(__Fuchsia__)
diff --git a/libcxx/include/__locale_dir/support/apple.h b/libcxx/include/__locale_dir/support/apple.h
deleted file mode 100644
index 62eb79c30d435..0000000000000
--- a/libcxx/include/__locale_dir/support/apple.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-----------------------------------------------------------------------===//
-//
-// 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_APPLE_H
-#define _LIBCPP___LOCALE_DIR_SUPPORT_APPLE_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_APPLE_H
diff --git a/libcxx/include/__locale_dir/support/freebsd.h b/libcxx/include/__locale_dir/support/freebsd.h
deleted file mode 100644
index 5c6e21e387271..0000000000000
--- a/libcxx/include/__locale_dir/support/freebsd.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-----------------------------------------------------------------------===//
-//
-// 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_FREEBSD_H
-#define _LIBCPP___LOCALE_DIR_SUPPORT_FREEBSD_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_FREEBSD_H
diff --git a/libcxx/include/__locale_dir/support/netbsd.h b/libcxx/include/__locale_dir/support/netbsd.h
deleted file mode 100644
index 190857f6f84fe..0000000000000
--- a/libcxx/include/__locale_dir/support/netbsd.h
+++ /dev/null
@@ -1,20 +0,0 @@
-//===-----------------------------------------------------------------------===//
-//
-// 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

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could fold the NetBSD and the FreeBSD ones, but the Apple one is extremely useful since it gives us a place to hold downstream diffs without friction.

I personally think the inconsistency of not having a header for each platform isn't worth the removal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants