diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2015-04-11 02:01:41 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2015-04-11 02:01:41 +0300 |
commit | 591fd365969b138f0e3e22ddce032cab6f66440b (patch) | |
tree | 399819ef86b3a19748bc4987d205f1a5bed850ee | |
parent | 361050cb4c64301a2937f60273b9b3537437198b (diff) | |
download | bdwgc-591fd365969b138f0e3e22ddce032cab6f66440b.tar.gz |
Re-enable gc_cpp.h usage for GC compiled without ATOMIC_UNCOLLECTABLE
GC_ATOMIC_UNCOLLECTABLE macro is recognized (in gc_cpp.h) to enable
GC_malloc_atomic_uncollectable functionality.
* include/gc_cpp.h (enum GCPlacement): Remove NoGCPointerFree alias.
* include/gc_cpp.h (enum GCPlacement): Do not declare PointerFreeNoGC
element unless GC_ATOMIC_UNCOLLECTABLE defined.
* include/gc_cpp.h (gc::operator new, operator new): Do not handle
PointerFreeNoGC (and do not call GC_MALLOC_ATOMIC_UNCOLLECTABLE) unless
GC_ATOMIC_UNCOLLECTABLE defined.
-rw-r--r-- | include/gc_cpp.h | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/include/gc_cpp.h b/include/gc_cpp.h index a97ef01a..2a240370 100644 --- a/include/gc_cpp.h +++ b/include/gc_cpp.h @@ -175,9 +175,10 @@ enum GCPlacement GC = UseGC, # endif NoGC, - PointerFreeGC, - PointerFreeNoGC, - NoGCPointerFree = PointerFreeNoGC + PointerFreeGC +# ifdef GC_ATOMIC_UNCOLLECTABLE + , PointerFreeNoGC +# endif }; /** @@ -329,8 +330,10 @@ inline void* gc::operator new(size_t size, GCPlacement gcp) return GC_MALLOC(size); case PointerFreeGC: return GC_MALLOC_ATOMIC(size); - case PointerFreeNoGC: - return GC_MALLOC_ATOMIC_UNCOLLECTABLE(size); +# ifdef GC_ATOMIC_UNCOLLECTABLE + case PointerFreeNoGC: + return GC_MALLOC_ATOMIC_UNCOLLECTABLE(size); +# endif case NoGC: default: return GC_MALLOC_UNCOLLECTABLE(size); @@ -426,8 +429,10 @@ inline void* operator new(size_t size, GCPlacement gcp, GCCleanUpFunc cleanup, return obj; case PointerFreeGC: return GC_MALLOC_ATOMIC(size); - case PointerFreeNoGC: - return GC_MALLOC_ATOMIC_UNCOLLECTABLE(size); +# ifdef GC_ATOMIC_UNCOLLECTABLE + case PointerFreeNoGC: + return GC_MALLOC_ATOMIC_UNCOLLECTABLE(size); +# endif case NoGC: default: return GC_MALLOC_UNCOLLECTABLE(size); |