[libcxx-commits] [libcxx] [libc++] Get rid of experimental/__config (PR #108233)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 11 07:16:44 PDT 2024
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/108233
It doesn't serve much of a purpose since we can easily put its contents inside __config. Removing it simplifies the modulemap once we are trying to create a single top-level module.
>From 41adfa49d3825eb79b64ca6528fd3d9519a3b8ff Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Wed, 11 Sep 2024 10:15:37 -0400
Subject: [PATCH] [libc++] Get rid of experimental/__config
It doesn't serve much of a purpose since we can easily put its
contents inside __config. Removing it simplifies the modulemap
once we are trying to create a single top-level module.
---
libcxx/include/CMakeLists.txt | 1 -
libcxx/include/__config | 9 ++++
libcxx/include/experimental/__config | 45 -------------------
.../include/experimental/__simd/aligned_tag.h | 2 +-
.../include/experimental/__simd/declaration.h | 9 +++-
.../include/experimental/__simd/reference.h | 2 +-
libcxx/include/experimental/__simd/scalar.h | 2 +-
libcxx/include/experimental/__simd/simd.h | 2 +-
.../include/experimental/__simd/simd_mask.h | 2 +-
libcxx/include/experimental/__simd/traits.h | 2 +-
libcxx/include/experimental/__simd/utility.h | 2 +-
libcxx/include/experimental/__simd/vec_ext.h | 2 +-
libcxx/include/experimental/iterator | 2 +-
libcxx/include/experimental/memory | 2 +-
libcxx/include/experimental/propagate_const | 2 +-
libcxx/include/experimental/simd | 2 +-
libcxx/include/experimental/type_traits | 2 +-
libcxx/include/experimental/utility | 2 +-
libcxx/include/module.modulemap | 4 --
libcxx/src/any.cpp | 2 +-
libcxx/src/optional.cpp | 2 +-
21 files changed, 33 insertions(+), 67 deletions(-)
delete mode 100644 libcxx/include/experimental/__config
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index a571832ab724d4..ffff8114e5870d 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -925,7 +925,6 @@ set(files
exception
execution
expected
- experimental/__config
experimental/__simd/aligned_tag.h
experimental/__simd/declaration.h
experimental/__simd/reference.h
diff --git a/libcxx/include/__config b/libcxx/include/__config
index bccf90d1dbacd2..7d1e41782766c3 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -593,6 +593,15 @@ typedef __char32_t char32_t;
inline namespace _LIBCPP_ABI_NAMESPACE {
# define _LIBCPP_END_NAMESPACE_STD }} _LIBCPP_POP_EXTENSION_DIAGNOSTICS
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL namespace std { namespace experimental {
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL }}
+
+#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
+#define _LIBCPP_END_NAMESPACE_LFTS } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
+
+#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 {
+#define _LIBCPP_END_NAMESPACE_LFTS_V2 } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
+
#ifdef _LIBCPP_ABI_NO_FILESYSTEM_INLINE_NAMESPACE
# define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM _LIBCPP_BEGIN_NAMESPACE_STD namespace filesystem {
# define _LIBCPP_END_NAMESPACE_FILESYSTEM } _LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/include/experimental/__config b/libcxx/include/experimental/__config
deleted file mode 100644
index 7b23791511ceff..00000000000000
--- a/libcxx/include/experimental/__config
+++ /dev/null
@@ -1,45 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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_EXPERIMENTAL_CONFIG
-#define _LIBCPP_EXPERIMENTAL_CONFIG
-
-#include <__config>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL \
- namespace std { \
- namespace experimental {
-#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL \
- } \
- }
-
-#define _LIBCPP_BEGIN_NAMESPACE_LFTS _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v1 {
-#define _LIBCPP_END_NAMESPACE_LFTS \
- } \
- } \
- }
-
-#define _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace fundamentals_v2 {
-#define _LIBCPP_END_NAMESPACE_LFTS_V2 \
- } \
- } \
- }
-
-// TODO: support more targets
-#if defined(__AVX__)
-# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
-#else
-# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16
-#endif
-
-#endif
diff --git a/libcxx/include/experimental/__simd/aligned_tag.h b/libcxx/include/experimental/__simd/aligned_tag.h
index 31d2b50aa1dd36..e364e146a60116 100644
--- a/libcxx/include/experimental/__simd/aligned_tag.h
+++ b/libcxx/include/experimental/__simd/aligned_tag.h
@@ -10,10 +10,10 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
#define _LIBCPP_EXPERIMENTAL___SIMD_ALIGNED_TAG_H
+#include <__config>
#include <__memory/assume_aligned.h>
#include <__type_traits/remove_const.h>
#include <cstddef>
-#include <experimental/__config>
#include <experimental/__simd/traits.h>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
diff --git a/libcxx/include/experimental/__simd/declaration.h b/libcxx/include/experimental/__simd/declaration.h
index 7b45d035c27121..2ac7224159cf35 100644
--- a/libcxx/include/experimental/__simd/declaration.h
+++ b/libcxx/include/experimental/__simd/declaration.h
@@ -10,11 +10,18 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
#define _LIBCPP_EXPERIMENTAL___SIMD_DECLARATION_H
+#include <__config>
#include <cstddef>
-#include <experimental/__config>
#if _LIBCPP_STD_VER >= 17 && defined(_LIBCPP_ENABLE_EXPERIMENTAL)
+// TODO: support more targets
+# if defined(__AVX__)
+# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
+# else
+# define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 16
+# endif
+
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
inline namespace parallelism_v2 {
namespace simd_abi {
diff --git a/libcxx/include/experimental/__simd/reference.h b/libcxx/include/experimental/__simd/reference.h
index c60c08b0ea459c..cba460baaa95bb 100644
--- a/libcxx/include/experimental/__simd/reference.h
+++ b/libcxx/include/experimental/__simd/reference.h
@@ -10,6 +10,7 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_REFERENCE_H
#define _LIBCPP_EXPERIMENTAL___SIMD_REFERENCE_H
+#include <__config>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_assignable.h>
#include <__type_traits/is_same.h>
@@ -17,7 +18,6 @@
#include <__utility/forward.h>
#include <__utility/move.h>
#include <cstddef>
-#include <experimental/__config>
#include <experimental/__simd/utility.h>
_LIBCPP_PUSH_MACROS
diff --git a/libcxx/include/experimental/__simd/scalar.h b/libcxx/include/experimental/__simd/scalar.h
index a2aeeb5cd0f54f..a76933e1a5849d 100644
--- a/libcxx/include/experimental/__simd/scalar.h
+++ b/libcxx/include/experimental/__simd/scalar.h
@@ -11,9 +11,9 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_SCALAR_H
#include <__assert>
+#include <__config>
#include <__type_traits/integral_constant.h>
#include <cstddef>
-#include <experimental/__config>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/simd.h b/libcxx/include/experimental/__simd/simd.h
index db0f9b39d9600c..2c65d19e67b36f 100644
--- a/libcxx/include/experimental/__simd/simd.h
+++ b/libcxx/include/experimental/__simd/simd.h
@@ -10,12 +10,12 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_SIMD_H
#define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_H
+#include <__config>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_same.h>
#include <__type_traits/remove_cvref.h>
#include <__utility/forward.h>
#include <cstddef>
-#include <experimental/__config>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/simd_mask.h b/libcxx/include/experimental/__simd/simd_mask.h
index d54d4898b718af..55273194153134 100644
--- a/libcxx/include/experimental/__simd/simd_mask.h
+++ b/libcxx/include/experimental/__simd/simd_mask.h
@@ -10,10 +10,10 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_SIMD_MASK_H
#define _LIBCPP_EXPERIMENTAL___SIMD_SIMD_MASK_H
+#include <__config>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_same.h>
#include <cstddef>
-#include <experimental/__config>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/reference.h>
#include <experimental/__simd/traits.h>
diff --git a/libcxx/include/experimental/__simd/traits.h b/libcxx/include/experimental/__simd/traits.h
index ec25b4bfa7f95e..b817df604ef72e 100644
--- a/libcxx/include/experimental/__simd/traits.h
+++ b/libcxx/include/experimental/__simd/traits.h
@@ -11,10 +11,10 @@
#define _LIBCPP_EXPERIMENTAL___SIMD_TRAITS_H
#include <__bit/bit_ceil.h>
+#include <__config>
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_same.h>
#include <cstddef>
-#include <experimental/__config>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/utility.h>
diff --git a/libcxx/include/experimental/__simd/utility.h b/libcxx/include/experimental/__simd/utility.h
index 708fa3d8f72cef..0103b06b719532 100644
--- a/libcxx/include/experimental/__simd/utility.h
+++ b/libcxx/include/experimental/__simd/utility.h
@@ -10,6 +10,7 @@
#ifndef _LIBCPP_EXPERIMENTAL___SIMD_UTILITY_H
#define _LIBCPP_EXPERIMENTAL___SIMD_UTILITY_H
+#include <__config>
#include <__type_traits/is_arithmetic.h>
#include <__type_traits/is_const.h>
#include <__type_traits/is_constant_evaluated.h>
@@ -22,7 +23,6 @@
#include <__utility/integer_sequence.h>
#include <cstddef>
#include <cstdint>
-#include <experimental/__config>
#include <limits>
_LIBCPP_PUSH_MACROS
diff --git a/libcxx/include/experimental/__simd/vec_ext.h b/libcxx/include/experimental/__simd/vec_ext.h
index 5787f237bb01ef..1f707cf3e18424 100644
--- a/libcxx/include/experimental/__simd/vec_ext.h
+++ b/libcxx/include/experimental/__simd/vec_ext.h
@@ -12,11 +12,11 @@
#include <__assert>
#include <__bit/bit_ceil.h>
+#include <__config>
#include <__type_traits/integral_constant.h>
#include <__utility/forward.h>
#include <__utility/integer_sequence.h>
#include <cstddef>
-#include <experimental/__config>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/traits.h>
#include <experimental/__simd/utility.h>
diff --git a/libcxx/include/experimental/iterator b/libcxx/include/experimental/iterator
index de82da2d3d72bd..edfe6e707bcec9 100644
--- a/libcxx/include/experimental/iterator
+++ b/libcxx/include/experimental/iterator
@@ -52,11 +52,11 @@ namespace std {
*/
+#include <__config>
#include <__memory/addressof.h>
#include <__type_traits/decay.h>
#include <__utility/forward.h>
#include <__utility/move.h>
-#include <experimental/__config>
#include <iterator>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/experimental/memory b/libcxx/include/experimental/memory
index e9663d43a8ab73..bf8a154690af01 100644
--- a/libcxx/include/experimental/memory
+++ b/libcxx/include/experimental/memory
@@ -49,6 +49,7 @@ public:
}
*/
+#include <__config>
#include <__functional/hash.h>
#include <__functional/operations.h>
#include <__type_traits/add_lvalue_reference.h>
@@ -57,7 +58,6 @@ public:
#include <__type_traits/enable_if.h>
#include <__type_traits/is_convertible.h>
#include <cstddef>
-#include <experimental/__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/experimental/propagate_const b/libcxx/include/experimental/propagate_const
index d7a695d8388923..510d374bb4bf94 100644
--- a/libcxx/include/experimental/propagate_const
+++ b/libcxx/include/experimental/propagate_const
@@ -107,6 +107,7 @@
*/
+#include <__config>
#include <__functional/operations.h>
#include <__fwd/functional.h>
#include <__type_traits/conditional.h>
@@ -128,7 +129,6 @@
#include <__utility/move.h>
#include <__utility/swap.h>
#include <cstddef>
-#include <experimental/__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/experimental/simd b/libcxx/include/experimental/simd
index 484543b81daf1f..35120b4b4aab42 100644
--- a/libcxx/include/experimental/simd
+++ b/libcxx/include/experimental/simd
@@ -75,7 +75,7 @@ inline namespace parallelism_v2 {
# pragma GCC system_header
#endif
-#include <experimental/__config>
+#include <__config>
#include <experimental/__simd/aligned_tag.h>
#include <experimental/__simd/declaration.h>
#include <experimental/__simd/reference.h>
diff --git a/libcxx/include/experimental/type_traits b/libcxx/include/experimental/type_traits
index 31b041bc94c43a..a4bb59afaf4ac2 100644
--- a/libcxx/include/experimental/type_traits
+++ b/libcxx/include/experimental/type_traits
@@ -68,7 +68,7 @@ inline namespace fundamentals_v1 {
*/
-#include <experimental/__config>
+#include <__config>
#if _LIBCPP_STD_VER >= 14
diff --git a/libcxx/include/experimental/utility b/libcxx/include/experimental/utility
index 8bd0a055b7783f..cbc7ad140e40c1 100644
--- a/libcxx/include/experimental/utility
+++ b/libcxx/include/experimental/utility
@@ -30,7 +30,7 @@ inline namespace fundamentals_v1 {
*/
-#include <experimental/__config>
+#include <__config>
#include <utility>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 65df579b8d6dd7..add8726dead428 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -610,10 +610,6 @@ module std_experimental [system] {
header "experimental/utility"
export *
}
- module __config {
- textual header "experimental/__config"
- export *
- }
}
// Convenience method to get all of the above modules in a single import statement.
diff --git a/libcxx/src/any.cpp b/libcxx/src/any.cpp
index b0ad695669dec4..eaca2dd2397650 100644
--- a/libcxx/src/any.cpp
+++ b/libcxx/src/any.cpp
@@ -12,7 +12,7 @@ namespace std {
const char* bad_any_cast::what() const noexcept { return "bad any cast"; }
} // namespace std
-#include <experimental/__config>
+#include <__config>
// Preserve std::experimental::any_bad_cast for ABI compatibility
// Even though it no longer exists in a header file
diff --git a/libcxx/src/optional.cpp b/libcxx/src/optional.cpp
index 62b474a312be2d..4e7e28898f8814 100644
--- a/libcxx/src/optional.cpp
+++ b/libcxx/src/optional.cpp
@@ -17,7 +17,7 @@ const char* bad_optional_access::what() const noexcept { return "bad_optional_ac
} // namespace std
-#include <experimental/__config>
+#include <__config>
// Preserve std::experimental::bad_optional_access for ABI compatibility
// Even though it no longer exists in a header file
More information about the libcxx-commits
mailing list