]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -fno-exceptions support in testsuite_allocator.h
authorPatrick Palka <ppalka@redhat.com>
Thu, 28 May 2026 14:41:33 +0000 (10:41 -0400)
committerPatrick Palka <ppalka@redhat.com>
Thu, 28 May 2026 14:41:33 +0000 (10:41 -0400)
This fixes the error

.../testsuite_allocator.h:402:13: error: exception handling disabled, use '-fexceptions' to enable
  402 |             catch(...)
      |             ^~~~~

seen when running some C++23 library tests with -fno-exceptions.

libstdc++-v3/ChangeLog:

* testsuite/util/testsuite_allocator.h
(uneq_allocator::allocate): Use __try/__catch instead.
(uneq_allocator::allocate_at_least): Likewise.

Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/testsuite/util/testsuite_allocator.h

index 27372a97161d721c65fb62b77eea7bcf860c8475..3a9ae0de5853d72cb8e1d5cbd08aceaed542be8e 100644 (file)
@@ -369,12 +369,12 @@ namespace __gnu_test
        if (std::__is_constant_evaluated())
          return p;
 
-       try
+       __try
          {
            get_map().insert(map_type::value_type(reinterpret_cast<void*>(p),
                                                  personality));
          }
-       catch(...)
+       __catch(...)
          {
            AllocTraits::deallocate(*this, p, n);
            __throw_exception_again;
@@ -394,12 +394,12 @@ namespace __gnu_test
          { return r; }
        else
          {
-           try
+           __try
              {
                get_map().insert(map_type::value_type(
                      reinterpret_cast<void*>(r.ptr), personality));
              }
-           catch(...)
+           __catch(...)
              {
                AllocTraits::deallocate(*this, r.ptr, r.count);
                __throw_exception_again;