-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++] Remove a few includes from <__hash_table> #99738
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9368674
to
ec6c298
Compare
@llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesFull diff: https://github.com/llvm/llvm-project/pull/99738.diff 5 Files Affected:
diff --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 025758528573f..d5fbc92a3dfc4 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -18,6 +18,7 @@
#include <__functional/hash.h>
#include <__functional/invoke.h>
#include <__iterator/iterator_traits.h>
+#include <__math/rounding_functions.h>
#include <__memory/addressof.h>
#include <__memory/allocator_traits.h>
#include <__memory/compressed_pair.h>
@@ -40,9 +41,8 @@
#include <__utility/move.h>
#include <__utility/pair.h>
#include <__utility/swap.h>
-#include <cmath>
#include <cstring>
-#include <initializer_list>
+#include <limits>
#include <new> // __launder
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -875,10 +875,10 @@ public:
_LIBCPP_HIDE_FROM_ABI void __rehash_unique(size_type __n) { __rehash<true>(__n); }
_LIBCPP_HIDE_FROM_ABI void __rehash_multi(size_type __n) { __rehash<false>(__n); }
_LIBCPP_HIDE_FROM_ABI void __reserve_unique(size_type __n) {
- __rehash_unique(static_cast<size_type>(std::ceil(__n / max_load_factor())));
+ __rehash_unique(static_cast<size_type>(__math::ceil(__n / max_load_factor())));
}
_LIBCPP_HIDE_FROM_ABI void __reserve_multi(size_type __n) {
- __rehash_multi(static_cast<size_type>(std::ceil(__n / max_load_factor())));
+ __rehash_multi(static_cast<size_type>(__math::ceil(__n / max_load_factor())));
}
_LIBCPP_HIDE_FROM_ABI size_type bucket_count() const _NOEXCEPT { return __bucket_list_.get_deleter().size(); }
@@ -1348,7 +1348,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique_prepare(size_t __
}
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
__rehash_unique(std::max<size_type>(
- 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
}
return nullptr;
}
@@ -1408,7 +1408,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi_prepare(size_t __c
size_type __bc = bucket_count();
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
__rehash_multi(std::max<size_type>(
- 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
size_t __chash = std::__constrain_hash(__cp_hash, __bc);
@@ -1483,7 +1483,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(const_iterator __p
size_type __bc = bucket_count();
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
__rehash_multi(std::max<size_type>(
- 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
size_t __chash = std::__constrain_hash(__cp->__hash_, __bc);
@@ -1523,7 +1523,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
__node_holder __h = __construct_node_hash(__hash, std::forward<_Args>(__args)...);
if (size() + 1 > __bc * max_load_factor() || __bc == 0) {
__rehash_unique(std::max<size_type>(
- 2 * __bc + !std::__is_hash_power2(__bc), size_type(std::ceil(float(size() + 1) / max_load_factor()))));
+ 2 * __bc + !std::__is_hash_power2(__bc), size_type(__math::ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
__chash = std::__constrain_hash(__hash, __bc);
}
@@ -1692,8 +1692,8 @@ void __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __n) _LIBCPP_D
else if (__n < __bc) {
__n = std::max<size_type>(
__n,
- std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(std::ceil(float(size()) / max_load_factor())))
- : std::__next_prime(size_t(std::ceil(float(size()) / max_load_factor()))));
+ std::__is_hash_power2(__bc) ? std::__next_hash_pow2(size_t(__math::ceil(float(size()) / max_load_factor())))
+ : std::__next_prime(size_t(__math::ceil(float(size()) / max_load_factor()))));
if (__n < __bc)
__do_rehash<_UniqueKeys>(__n);
}
diff --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index 7c31c4fce26b0..acf3485e644af 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -2532,6 +2532,7 @@ _LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <algorithm>
# include <bit>
+# include <cmath>
# include <concepts>
# include <cstdlib>
# include <iterator>
diff --git a/libcxx/include/unordered_set b/libcxx/include/unordered_set
index 3297294a893f8..d11ceacba8143 100644
--- a/libcxx/include/unordered_set
+++ b/libcxx/include/unordered_set
@@ -1800,6 +1800,7 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+# include <cmath>
# include <concepts>
# include <cstdlib>
# include <functional>
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 8ffb71d8b566b..591f58cd83e06 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -649,7 +649,6 @@ typeindex typeinfo
typeindex version
typeinfo cstddef
typeinfo cstdint
-unordered_map cmath
unordered_map compare
unordered_map cstddef
unordered_map cstdint
@@ -661,7 +660,6 @@ unordered_map optional
unordered_map stdexcept
unordered_map tuple
unordered_map version
-unordered_set cmath
unordered_set compare
unordered_set cstddef
unordered_set cstdint
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 8ffb71d8b566b..591f58cd83e06 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -649,7 +649,6 @@ typeindex typeinfo
typeindex version
typeinfo cstddef
typeinfo cstdint
-unordered_map cmath
unordered_map compare
unordered_map cstddef
unordered_map cstdint
@@ -661,7 +660,6 @@ unordered_map optional
unordered_map stdexcept
unordered_map tuple
unordered_map version
-unordered_set cmath
unordered_set compare
unordered_set cstddef
unordered_set cstdint
|
bherrera
pushed a commit
to misttech/mist-os
that referenced
this pull request
Aug 23, 2024
In llvm/llvm-project#99738 libc++ removed cmath from one of its header files, and several places in Fuchsia are no longer including the required header for rounding functions. Additionally, it seems some code is no longer picking up chrono. Fixed: 359865937 Change-Id: Ica6e269a0d3b0dace2f551099f8ed42bd8990857 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1100755 Fuchsia-Auto-Submit: Paul Kirth <[email protected]> Commit-Queue: Auto-Submit <[email protected]> Reviewed-by: Garratt Gallagher <[email protected]> Reviewed-by: Craig Stout <[email protected]> Reviewed-by: Suraj Malhotra <[email protected]> Owners-Override: James Robinson <[email protected]>
bherrera
pushed a commit
to misttech/mist-os
that referenced
this pull request
Aug 23, 2024
…pdate In llvm/llvm-project#99738 libc++ removed cmath from one of its header files, and several places in Fuchsia are no longer including the required header for rounding functions. Original-Bug: 359865937 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1100813 Original-Revision: 80f803c32ad67dc22d9cb84273f16a736fe2db7b GitOrigin-RevId: e9d3d70a0c7c65a201e9087f9f526d30db1cb3bc Roller-URL: https://ci.chromium.org/b/8739602528693142561 CQ-Do-Not-Cancel-Tryjobs: true Change-Id: Ia38b905f54c1a0dadabe2006416ea39d9223c9b3 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1100757
bherrera
pushed a commit
to misttech/integration
that referenced
this pull request
Aug 23, 2024
In llvm/llvm-project#99738 libc++ removed cmath from one of its header files, and several places in Fuchsia are no longer including the required header for rounding functions. Additionally, it seems some code is no longer picking up chrono. Original-Fixed: 359865937 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1100755 Owners-Override: James Robinson <[email protected]> Original-Revision: 48579ca230b544ff7fc888910208cc455ff24b7b GitOrigin-RevId: 98f3c6f8b3708bac4a1a55b4320c65e6aa6bbb59 Change-Id: Id61e92d586532ab750e91df21de13efa9f4024d2
bherrera
pushed a commit
to misttech/integration
that referenced
this pull request
Aug 23, 2024
In llvm/llvm-project#99738 libc++ removed cmath from one of its header files, and several places in Fuchsia are no longer including the required header for rounding functions. Original-Bug: 359865937 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1100813 Original-Revision: 80f803c32ad67dc22d9cb84273f16a736fe2db7b GitOrigin-RevId: e9d3d70a0c7c65a201e9087f9f526d30db1cb3bc Change-Id: Id85d25288760dfb087fcbd460e7b222c927b0cda
bherrera
pushed a commit
to misttech/integration
that referenced
this pull request
Aug 23, 2024
…aders after libc++ update In llvm/llvm-project#99738 libc++ removed cmath from one of its header files, and several places in Fuchsia are no longer including the required header for rounding functions. Original-Bug: 359865937 Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/cobalt/+/1100813 Original-Revision: 80f803c32ad67dc22d9cb84273f16a736fe2db7b GitOrigin-RevId: 3cae18f4f00356f6bed6394e7561eea02ffed91b Roller-URL: https://ci.chromium.org/b/8739602528693142561 CQ-Do-Not-Cancel-Tryjobs: true Original-Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/1100757 Original-Revision: c43cf0a3806e0700e6358088645b21d32b5f74a5 Change-Id: Icfa99b5d03dc0a428fdee6f9e5cdf5b789db957a
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.