// { dg-options "-fwhole-program" }
// { dg-additional-options "-static-libstdc++" { target *-*-mingw* } }
+// { dg-require-effective-target std_allocator_new }
// { dg-xfail-run-if "AIX operator new" { powerpc-ibm-aix* } }
// Copyright (C) 2011-2021 Free Software Foundation, Inc.
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
+// { dg-require-effective-target std_allocator_new }
+
// 20.4.1.1 allocator members
#include <memory>
bool check_new = false;
bool check_delete = false;
-void*
+void*
operator new(std::size_t n) THROW(std::bad_alloc)
{
check_new = true;
{
std::allocator<gnu> obj;
- // NB: These should work for various size allocation and
- // deallocations. Currently, they only work as expected for sizes >
- // _MAX_BYTES as defined in stl_alloc.h, which happes to be 128.
gnu* pobj = obj.allocate(256);
VERIFY( check_new );
// <http://www.gnu.org/licenses/>.
// { dg-options "-faligned-new" }
-// { dg-do run { target c++11 } }
+// { dg-do run { target { c++11 && { c++17 || std_allocator_new } } } }
// { dg-require-cstdint "" }
#include <memory>
// { dg-do run { target c++17 } }
+// { dg-require-effective-target std_allocator_new }
// Copyright (C) 2021 Free Software Foundation, Inc.
//
// { dg-do run { target c++17 } }
+// { dg-require-effective-target std_allocator_new }
// Copyright (C) 2021 Free Software Foundation, Inc.
//
// { dg-do run { target c++17 } }
+// { dg-require-effective-target std_allocator_new }
// Copyright (C) 2021 Free Software Foundation, Inc.
//
// { dg-do run { target c++17 } }
+// { dg-require-effective-target std_allocator_new }
// Copyright (C) 2021 Free Software Foundation, Inc.
//
// { dg-require-time "" }
// { dg-require-cstdint "" }
+// { dg-require-effective-target std_allocator_new }
#include <cstdlib>
#include <ext/throw_allocator.h>
// { dg-require-time "" }
// { dg-require-cstdint "" }
+// { dg-require-effective-target std_allocator_new }
#include <cstdlib>
#include <ext/throw_allocator.h>
}]
}
+# Return 1 if libstdc++ was built as --enable-libstdcxx-allocator=new
+proc check_effective_target_std_allocator_new { } {
+ return [check_v3_target_prop_cached et_std_alloc_new {
+ set cond "_GLIBCXX_USE_ALLOCATOR_NEW"
+ return [v3_check_preprocessor_condition std_alloc_new $cond]
+ }]
+}
+
set additional_prunes ""
if { [info exists env(GCC_RUNTEST_PARALLELIZE_DIR)] \