]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/container/test/global_resource_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / container / test / global_resource_test.cpp
index 860b46393a583f56aed0af790f3b93024037277b..bb6e9683727d96263ab8079c547e851b90ac122b 100644 (file)
 using namespace boost::container;
 using namespace boost::container::pmr;
 
-std::size_t allocation_count = 0;
-
 #ifdef BOOST_MSVC
 #pragma warning (push)
 #pragma warning (disable : 4290)
 #endif
 
-#if defined(BOOST_GCC) && (BOOST_GCC >= 40700) && (__cplusplus >= 201103L)
+#if __cplusplus >= 201103L
 #define BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
 #define BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER noexcept
 #else
@@ -39,6 +37,11 @@ std::size_t allocation_count = 0;
 #pragma GCC diagnostic ignored "-Wsized-deallocation"
 #endif
 
+//ASAN does not support operator new overloading
+#ifndef BOOST_CONTAINER_ASAN
+
+std::size_t allocation_count = 0;
+
 void* operator new[](std::size_t count) BOOST_CONTAINER_NEW_EXCEPTION_SPECIFIER
 {
    ++allocation_count;
@@ -51,10 +54,14 @@ void operator delete[](void *p) BOOST_CONTAINER_DELETE_EXCEPTION_SPECIFIER
    return std::free(p);
 }
 
+#endif   //BOOST_CONTAINER_ASAN
+
 #ifdef BOOST_MSVC
 #pragma warning (pop)
 #endif
 
+#ifndef BOOST_CONTAINER_ASAN
+
 void test_new_delete_resource()
 {
    //Make sure new_delete_resource calls new[]/delete[]
@@ -73,6 +80,8 @@ void test_new_delete_resource()
    BOOST_TEST(memcount == allocation_count);
 }
 
+#endif   //BOOST_CONTAINER_ASAN
+
 void test_null_memory_resource()
 {
    //Make sure it throw or returns null
@@ -109,7 +118,9 @@ void test_default_resource()
 
 int main()
 {
+   #ifndef BOOST_CONTAINER_ASAN
    test_new_delete_resource();
+   #endif
    test_null_memory_resource();
    test_default_resource();
    return ::boost::report_errors();