@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -34,7 +35,7 @@ void test01()
typedef std::deque<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -49,7 +50,7 @@ void test02()
typedef std::deque<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -34,7 +35,7 @@ void test01()
typedef std::forward_list<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -49,7 +50,7 @@ void test02()
typedef std::forward_list<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -34,7 +35,7 @@ void test01()
typedef std::list<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
VERIFY( buf._M_ptr()->get_allocator().state != 0 );
@@ -51,7 +52,7 @@ void test02()
typedef std::list<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
VERIFY( buf._M_ptr()->get_allocator().state != 0 );
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -34,7 +35,7 @@ void test01()
typedef std::map<T, T, std::less<T>, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -49,7 +50,7 @@ void test02()
typedef std::map<T, T, std::less<T>, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -34,7 +35,7 @@ void test01()
typedef std::set<T, std::less<T>, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -49,7 +50,7 @@ void test02()
typedef std::set<T, std::less<T>, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -35,7 +36,7 @@ void test01()
alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -51,7 +52,7 @@ void test02()
alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -35,7 +36,7 @@ void test01()
alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -51,7 +52,7 @@ void test02()
alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = int;
@@ -34,7 +35,7 @@ void test01()
typedef std::vector<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -49,7 +50,7 @@ void test02()
typedef std::vector<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -22,6 +22,7 @@
#include <testsuite_hooks.h>
#include <testsuite_allocator.h>
+#include <cstring>
#include <ext/aligned_buffer.h>
using T = bool;
@@ -34,7 +35,7 @@ void test01()
typedef std::vector<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type;
@@ -49,7 +50,7 @@ void test02()
typedef std::vector<T, alloc_type> test_type;
__gnu_cxx::__aligned_buffer<test_type> buf;
- __builtin_memset(buf._M_addr(), ~0, sizeof(test_type));
+ std::memset(buf._M_addr(), ~0, sizeof(test_type));
test_type *tmp = ::new(buf._M_addr()) test_type();
@@ -3,6 +3,7 @@
// { dg-add-options libatomic }
#include <atomic>
+#include <cstring>
#include <testsuite_hooks.h>
@@ -10,11 +11,11 @@ struct S { char c; short s; };
void __attribute__((noinline,noipa))
fill_struct(S& s)
-{ __builtin_memset(&s, 0xff, sizeof(S)); }
+{ std::memset(&s, 0xff, sizeof(S)); }
bool
compare_struct(const S& a, const S& b)
-{ return __builtin_memcmp(&a, &b, sizeof(S)) == 0; }
+{ return std::memcmp(&a, &b, sizeof(S)) == 0; }
int
main ()
@@ -21,11 +21,10 @@
#include <concepts>
#include <mutex>
#include <thread>
+#include <cstring>
#include <testsuite_hooks.h>
-#include <iostream>
-
template<typename Tp>
Tp check_wait_notify(Tp val1, Tp val2)
requires std::equality_comparable<Tp>
@@ -76,7 +75,7 @@ Tp check_wait_notify(Tp val1, Tp val2)
a.wait(val1);
auto v = a.load();
// TODO this needs to zero padding bits when we can do that
- if (__builtin_memcmp(&v, &val2, sizeof(Tp)) != 0)
+ if (std::memcmp(&v, &val2, sizeof(Tp)) != 0)
a = val1;
});
cv.wait(l);
@@ -137,7 +136,7 @@ Tp check_atomic_wait_notify(Tp val1, Tp val2)
std::atomic_wait(&a, val1);
auto v = a.load();
// TODO this needs to zero padding bits when we can do that
- if (__builtin_memcmp(&v, &val2, sizeof(Tp)) != 0)
+ if (std::memcmp(&v, &val2, sizeof(Tp)) != 0)
a = val1;
});
cv.wait(l);
@@ -163,13 +162,13 @@ struct check
{
// TODO this needs to zero padding bits when we can do that
auto v = check_wait_notify(a, b);
- VERIFY( __builtin_memcmp(&v, &b, sizeof(Tp)) == 0 );
+ VERIFY( std::memcmp(&v, &b, sizeof(Tp)) == 0 );
}
{
// TODO this needs to zero padding bits when we can do that
auto v = check_atomic_wait_notify(a, b);
- VERIFY( __builtin_memcmp(&v, &b, sizeof(Tp)) == 0);
+ VERIFY( std::memcmp(&v, &b, sizeof(Tp)) == 0);
}
}
}