]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/libsupc++/new_opnt.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / libsupc++ / new_opnt.cc
index ffe44b939bb5400af347e2938c27f6b5f7f52fb4..099c08092e92789e3b426e54d8b99efa658503da 100644 (file)
@@ -1,5 +1,5 @@
 // Support routines for the -*- C++ -*- dynamic memory management.
-// Copyright (C) 1997-2018 Free Software Foundation, Inc.
+// Copyright (C) 1997-2024 Free Software Foundation, Inc.
 //
 // This file is part of GCC.
 //
@@ -26,9 +26,6 @@
 #include <bits/exception_defines.h>
 #include "new"
 
-using std::new_handler;
-using std::bad_alloc;
-
 extern "C" void *malloc (std::size_t);
 
 _GLIBCXX_WEAK_DEFINITION void *
@@ -43,6 +40,13 @@ operator new (std::size_t sz, const std::nothrow_t&) noexcept
     }
   __catch (...)
     {
+      // N.B. catch (...) means the process will terminate if operator new(sz)
+      // exits with a __forced_unwind exception. The process will print
+      // "FATAL: exception not rethrown" to stderr before exiting.
+      //
+      // If we propagated that exception the process would still terminate
+      // (because this function is noexcept) but with a less informative error:
+      // "terminate called without active exception".
       return nullptr;
     }
 }