summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2023-04-14 09:27:05 +0300
committerIvan Maidanski <ivmai@mail.ru>2023-04-17 12:05:53 +0300
commitd1bc109ec4d548a6977060affe0012b1643bedf5 (patch)
tree5441453347dc61f78fd0da4c219c9f7acb55b7bc /include
parent9b1a6e6d32915cfc24eacd5d6b4ba68d1d74eb74 (diff)
downloadbdwgc-d1bc109ec4d548a6977060affe0012b1643bedf5.tar.gz
Ensure 'new' system header is included by gc_cpp.h if GC_INCLUDE_NEW
* include/gc/gc_cpp.h [GC_INCLUDE_NEW]: Include <new> right after include gc.h (regardless of GC_NEW_ABORTS_ON_OOM and _LIBCPP_NO_EXCEPTIONS).
Diffstat (limited to 'include')
-rw-r--r--include/gc/gc_cpp.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/gc/gc_cpp.h b/include/gc/gc_cpp.h
index 7fa81ecc..60281c0b 100644
--- a/include/gc/gc_cpp.h
+++ b/include/gc/gc_cpp.h
@@ -127,6 +127,10 @@ by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined.
#include "gc.h"
+#ifdef GC_INCLUDE_NEW
+# include <new> // for std, bad_alloc
+#endif
+
#ifdef GC_NAMESPACE
# define GC_NS_QUALIFY(T) boehmgc::T
#else
@@ -162,7 +166,6 @@ by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined.
# define GC_OP_NEW_OOM_CHECK(obj) \
do { if (!(obj)) GC_abort_on_oom(); } while (0)
#elif defined(GC_INCLUDE_NEW)
-# include <new> // for bad_alloc
# define GC_OP_NEW_OOM_CHECK(obj) if (obj) {} else throw std::bad_alloc()
#else
// "new" header is not included, so bad_alloc cannot be thrown directly.