[libcxx-commits] [libcxxabi] [libc++] Fix the behavior of throwing `operator new` under -fno-exceptions (PR #69498)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 19 10:52:05 PDT 2023


================
@@ -0,0 +1,38 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___OVERRIDABLE_FUNCTION
+#define _LIBCPP___OVERRIDABLE_FUNCTION
+
+#include <__config>
+#include <cstdint>
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#define _LIBCPP_MAKE_OVERRIDABLE_FUNCTION_DETECTABLE                                                                   \
+  __attribute__((__section__("__TEXT,__lcxx_override,regular,pure_instructions")))
----------------
ldionne wrote:

Yeah, that's right. In a way, this is "fortunate" since this whole `__overridable_function` thing is only used to power the assertion we have in case a user forgot to override the `nothrow` version. So we could just disable it on some platforms -- but in practice it would be really nice to have this diagnostic on all supported platforms, since this is so tricky.

https://github.com/llvm/llvm-project/pull/69498


More information about the libcxx-commits mailing list