summaryrefslogtreecommitdiff
path: root/boehm-gc/include/gc_cpp.h
diff options
context:
space:
mode:
authorbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-21 06:39:25 +0000
committerbryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4>2001-05-21 06:39:25 +0000
commite46d228c487acde2ac1bdcd445bae97168d80674 (patch)
tree5049e5152a8f83009f083e416b2049c79cdd67da /boehm-gc/include/gc_cpp.h
parentc2a53dc0e7a58c4ddab0354e5cf5d9cd0e7f3518 (diff)
downloadgcc-e46d228c487acde2ac1bdcd445bae97168d80674.tar.gz
This commit was generated by cvs2svn to compensate for changes in r42373,
which included commits to RCS files with non-trunk default branches. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42374 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'boehm-gc/include/gc_cpp.h')
-rw-r--r--boehm-gc/include/gc_cpp.h51
1 files changed, 50 insertions, 1 deletions
diff --git a/boehm-gc/include/gc_cpp.h b/boehm-gc/include/gc_cpp.h
index 35686fc3527..6aacd0aea04 100644
--- a/boehm-gc/include/gc_cpp.h
+++ b/boehm-gc/include/gc_cpp.h
@@ -139,7 +139,7 @@ by UseGC. GC is an alias for UseGC, unless GC_NAME_CONFLICT is defined.
#if ! defined( OPERATOR_NEW_ARRAY ) \
&& (__BORLANDC__ >= 0x450 || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6) \
- || __WATCOMC__ >= 1050)
+ || __WATCOMC__ >= 1050 || _MSC_VER >= 1100)
# define OPERATOR_NEW_ARRAY
#endif
@@ -179,6 +179,12 @@ private:
extern "C" {typedef void (*GCCleanUpFunc)( void* obj, void* clientData );}
+#ifdef _MSC_VER
+ // Disable warning that "no matching operator delete found; memory will
+ // not be freed if initialization throws an exception"
+# pragma warning(disable:4291)
+#endif
+
inline void* operator new(
size_t size,
GCPlacement gcp,
@@ -200,6 +206,49 @@ inline void* operator new(
#ifdef OPERATOR_NEW_ARRAY
+#ifdef _MSC_VER
+ /** This ensures that the system default operator new[] doesn't get
+ * undefined, which is what seems to happen on VC++ 6 for some reason
+ * if we define a multi-argument operator new[].
+ * There seems to be really redirect new in this environment without
+ * including this everywhere.
+ */
+ inline void *operator new[]( size_t size )
+ {
+ return GC_MALLOC_UNCOLLECTABLE( size );
+ }
+
+ inline void operator delete[](void* obj)
+ {
+ GC_FREE(obj);
+ };
+
+ inline void* operator new( size_t size)
+ {
+ return GC_MALLOC_UNCOLLECTABLE( size);
+ };
+
+ inline void operator delete(void* obj)
+ {
+ GC_FREE(obj);
+ };
+
+
+// This new operator is used by VC++ in case of Debug builds !
+ inline void* operator new( size_t size,
+ int ,//nBlockUse,
+ const char * szFileName,
+ int nLine
+ ) {
+# ifndef GC_DEBUG
+ return GC_malloc_uncollectable( size );
+# else
+ return GC_debug_malloc_uncollectable(size, szFileName, nLine);
+# endif
+ }
+
+#endif /* _MSC_VER */
+
inline void* operator new[](
size_t size,
GCPlacement gcp,