aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/__cxx03/__algorithm/count.h10
-rw-r--r--libcxx/include/__cxx03/__algorithm/for_each.h6
-rw-r--r--libcxx/include/__cxx03/__bit/popcount.h12
-rw-r--r--libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp1
-rw-r--r--libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp4
-rw-r--r--libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp4
-rw-r--r--libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp4
-rw-r--r--libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp4
-rw-r--r--libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp4
-rw-r--r--libcxx/test/support/test_macros.h6
10 files changed, 19 insertions, 36 deletions
diff --git a/libcxx/include/__cxx03/__algorithm/count.h b/libcxx/include/__cxx03/__algorithm/count.h
index 5440fd0..5b05b4b 100644
--- a/libcxx/include/__cxx03/__algorithm/count.h
+++ b/libcxx/include/__cxx03/__algorithm/count.h
@@ -54,18 +54,18 @@ __count_bool(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
if (__first.__ctz_ != 0) {
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = std::min(__clz_f, __n);
- __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
- __r = std::__libcpp_popcount(std::__invert_if<!_ToCount>(*__first.__seg_) & __m);
+ __storage_type __m = (__storage_type(~0) << __first.__ctz_) & (__storage_type(~0) >> (__clz_f - __dn));
+ __r = std::__libcpp_popcount<__storage_type>(std::__invert_if<!_ToCount>(*__first.__seg_) & __m);
__n -= __dn;
++__first.__seg_;
}
// do middle whole words
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
- __r += std::__libcpp_popcount(std::__invert_if<!_ToCount>(*__first.__seg_));
+ __r += std::__libcpp_popcount<__storage_type>(std::__invert_if<!_ToCount>(*__first.__seg_));
// do last partial word
if (__n > 0) {
- __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __r += std::__libcpp_popcount(std::__invert_if<!_ToCount>(*__first.__seg_) & __m);
+ __storage_type __m = __storage_type(~0) >> (__bits_per_word - __n);
+ __r += std::__libcpp_popcount<__storage_type>(std::__invert_if<!_ToCount>(*__first.__seg_) & __m);
}
return __r;
}
diff --git a/libcxx/include/__cxx03/__algorithm/for_each.h b/libcxx/include/__cxx03/__algorithm/for_each.h
index d160a9e..1ffb013 100644
--- a/libcxx/include/__cxx03/__algorithm/for_each.h
+++ b/libcxx/include/__cxx03/__algorithm/for_each.h
@@ -14,15 +14,11 @@
#include <__cxx03/__config>
#include <__cxx03/__iterator/segmented_iterator.h>
#include <__cxx03/__type_traits/enable_if.h>
-#include <__cxx03/__utility/move.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
-_LIBCPP_PUSH_MACROS
-#include <__cxx03/__undef_macros>
-
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Function>
@@ -34,6 +30,4 @@ _LIBCPP_HIDE_FROM_ABI _Function for_each(_InputIterator __first, _InputIterator
_LIBCPP_END_NAMESPACE_STD
-_LIBCPP_POP_MACROS
-
#endif // _LIBCPP___CXX03___ALGORITHM_FOR_EACH_H
diff --git a/libcxx/include/__cxx03/__bit/popcount.h b/libcxx/include/__cxx03/__bit/popcount.h
index 64404d2..a61a921 100644
--- a/libcxx/include/__cxx03/__bit/popcount.h
+++ b/libcxx/include/__cxx03/__bit/popcount.h
@@ -6,9 +6,6 @@
//
//===----------------------------------------------------------------------===//
-// TODO: __builtin_popcountg is available since Clang 19 and GCC 14. When support for older versions is dropped, we can
-// refactor this code to exclusively use __builtin_popcountg.
-
#ifndef _LIBCPP___CXX03___BIT_POPCOUNT_H
#define _LIBCPP___CXX03___BIT_POPCOUNT_H
@@ -25,12 +22,9 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-inline _LIBCPP_HIDE_FROM_ABI int __libcpp_popcount(unsigned __x) _NOEXCEPT { return __builtin_popcount(__x); }
-
-inline _LIBCPP_HIDE_FROM_ABI int __libcpp_popcount(unsigned long __x) _NOEXCEPT { return __builtin_popcountl(__x); }
-
-inline _LIBCPP_HIDE_FROM_ABI int __libcpp_popcount(unsigned long long __x) _NOEXCEPT {
- return __builtin_popcountll(__x);
+template <class _Tp>
+_LIBCPP_HIDE_FROM_ABI int __libcpp_popcount(_Tp __v) {
+ return __builtin_popcountg(__v);
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp
index e696dcd..ffe3e0e 100644
--- a/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp
+++ b/libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp
@@ -15,7 +15,6 @@
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=20000000
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-ops-limit): -fconstexpr-ops-limit=80000000
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
#include <algorithm>
#include <cassert>
diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
index 3e4c5b1..c9a0fa1 100644
--- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/assign_copy.pass.cpp
@@ -14,8 +14,6 @@
// unordered_map& operator=(const unordered_map& u);
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
#include <algorithm>
#include <cassert>
#include <cfloat>
@@ -270,7 +268,7 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
V rhs_arr[] = {V(10, 4), V(13, 5), V(12, 324), V(0, 54), V(50, 5), V(2, 5)};
Map copy(begin(rhs_arr), end(rhs_arr), 0, std::hash<int>(), std::equal_to<int>(), rhs_alloc);
copy = orig;
- LIBCPP_ASSERT(copy.bucket_count() == 5);
+ LIBCPP_NON_FROZEN_ASSERT(copy.bucket_count() == 5);
assert(copy.size() == 4);
assert(copy.at(1) == 1);
assert(copy.at(2) == 3);
diff --git a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
index 938b6be..beb67d8 100644
--- a/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/assign_copy.pass.cpp
@@ -14,8 +14,6 @@
// unordered_multimap& operator=(const unordered_multimap& u);
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
#include <algorithm>
#include <cassert>
#include <cfloat>
@@ -289,7 +287,7 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
V rhs_arr[] = {V(10, 4), V(13, 5), V(12, 324), V(0, 54), V(50, 5), V(2, 5)};
Map copy(begin(rhs_arr), end(rhs_arr), 0, std::hash<int>(), std::equal_to<int>(), rhs_alloc);
copy = orig;
- LIBCPP_ASSERT(copy.bucket_count() == 5);
+ LIBCPP_NON_FROZEN_ASSERT(copy.bucket_count() == 5);
assert(copy.size() == 4);
assert(copy.find(1)->second == 1);
assert(copy.find(2)->second == 3);
diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
index e415253..5c85676 100644
--- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/assign_copy.pass.cpp
@@ -14,8 +14,6 @@
// unordered_multiset& operator=(const unordered_multiset& u);
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
#include <algorithm>
#include <cassert>
#include <cfloat>
@@ -259,7 +257,7 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
int rhs_arr[] = {10, 13, 12, 0, 50, 2};
Set copy(std::begin(rhs_arr), std::end(rhs_arr), 0, std::hash<int>(), std::equal_to<int>(), rhs_alloc);
copy = orig;
- LIBCPP_ASSERT(copy.bucket_count() == 5);
+ LIBCPP_NON_FROZEN_ASSERT(copy.bucket_count() == 5);
assert(copy.size() == 4);
assert(copy.count(1) == 1);
assert(copy.count(2) == 1);
diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
index 9828b8b..30e12e2 100644
--- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
+++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/assign_copy.pass.cpp
@@ -14,8 +14,6 @@
// unordered_set& operator=(const unordered_set& u);
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
#include <algorithm>
#include <cassert>
#include <cfloat>
@@ -262,7 +260,7 @@ void test_alloc(const Alloc& lhs_alloc = Alloc(),
int rhs_arr[] = {10, 13, 12, 0, 50, 2};
Set copy(std::begin(rhs_arr), std::end(rhs_arr), 0, std::hash<int>(), std::equal_to<int>(), rhs_alloc);
copy = orig;
- LIBCPP_ASSERT(copy.bucket_count() == 5);
+ LIBCPP_NON_FROZEN_ASSERT(copy.bucket_count() == 5);
assert(copy.size() == 4);
assert(copy.count(1) == 1);
assert(copy.count(2) == 1);
diff --git a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
index 572a14e..fed5b4a 100644
--- a/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
+++ b/libcxx/test/std/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp
@@ -12,8 +12,6 @@
// iter_type put(iter_type s, ios_base& iob, char_type fill, void* v) const;
-// XFAIL: FROZEN-CXX03-HEADERS-FIXME
-
#include <cassert>
#include <ios>
#include <locale>
@@ -36,7 +34,7 @@ int main(int, char**) {
cpp17_output_iterator<char*> iter = f.put(cpp17_output_iterator<char*>(str), ios, '*', v);
std::string ex(str, base(iter));
assert(!ex.empty());
- LIBCPP_ASSERT(ex == "0");
+ LIBCPP_NON_FROZEN_ASSERT(ex == "0");
}
return 0;
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h
index 2fc25fc..c4e1600 100644
--- a/libcxx/test/support/test_macros.h
+++ b/libcxx/test/support/test_macros.h
@@ -264,6 +264,12 @@
#define LIBCPP_ONLY(...) static_assert(true, "")
#endif
+#ifdef _LIBCPP_USE_FROZEN_CXX03_HEADERS
+# define LIBCPP_NON_FROZEN_ASSERT(...) static_assert(true, "")
+#else
+# define LIBCPP_NON_FROZEN_ASSERT(...) LIBCPP_ASSERT(__VA_ARGS__)
+#endif
+
#if __has_cpp_attribute(nodiscard)
# define TEST_NODISCARD [[nodiscard]]
#else