[CLN-list] Re: cln: ungeklärte Probleme (fwd)
Richard B. Kreckel
kreckel at thep.physik.uni-mainz.de
Sat Dec 4 00:18:05 CET 2004
Hi!
Ralf: I take this discussion to the mailing list in the hope that somebody
there might have an idea.
All others: Ralf and I were discussing a small experimental patch (see
attachment) that balances all operator new and delete in order to please
certain compilers. In particular, I added many no-op operator placement
deletes. It also added some unimplemented declarations of private
operator delete(void*) member functions to classes that had unimplemented
private operator new(size_t).
That patch had no effect on the code generated by GCC. However, the Intel
compiler complained abaout four missing symbols:
On Fri, 3 Dec 2004, Ralf Wildenhues wrote:
> * Richard B. Kreckel wrote on Thu, Dec 02, 2004 at 10:17:20PM CET:
> > On Thu, 2 Dec 2004, Ralf Wildenhues wrote:
> > > cl_SV_ringelt.o: cln::cl_SV_inner<cln::_cl_ring_element>::operator delete(void*)
> > > cl_SV_number.o: cln::cl_SV_inner<cln::cl_number>::operator delete(void*)
> > > cl_GV_number.o: cln::cl_GV_inner<cln::cl_number>::operator delete(void*)
> > > cl_GV_I.o: cln::cl_GV_inner<cln::cl_I>::operator delete(void*)
> >
> > Bitte schick' mir mal die drei Dateien zum Disassemblen.
>
> Hier sind die vier. :-)
Disassembling the four offending objects established the following
(linear) call-graphs (not every symbol could be demangled by GNU objdump):
cln::cl_svector_ringelt_destructor(cln::cl_heap*)
cln::cl_heap_SV<cln::_cl_ring_element>::~cl_heap_SV()
_ZN3cln10cl_heap_SVINS_16_cl_ring_elementEED9Ev
cln::cl_SV_inner<cln::_cl_ring_element>::~cl_SV_inner()
_ZN3cln11cl_SV_innerINS_16_cl_ring_elementEED9Ev
cln::cl_SV_inner<cln::_cl_ring_element>::operator delete(void*)
cln::cl_svector_number_destructor(cln::cl_heap*)
cln::cl_heap_SV<cln::cl_number>::~cl_heap_SV()
_ZN3cln10cl_heap_SVINS_9cl_numberEED9Ev
cln::cl_SV_inner<cln::cl_number>::~cl_SV_inner()
_ZN3cln11cl_SV_innerINS_9cl_numberEED9Ev
cln::cl_SV_inner<cln::cl_number>::operator delete(void*)
cln::cl_gvector_number_destructor(cln::cl_heap*)
cln::cl_heap_GV<cln::cl_number>::~cl_heap_GV()
_ZN3cln10cl_heap_GVINS_9cl_numberEED9Ev
cln::cl_GV_inner<cln::cl_number>::~cl_GV_inner()
_ZN3cln11cl_GV_innerINS_9cl_numberEED9Ev
cln::cl_GV_inner<cln::cl_number>::operator delete(void*)
cln::cl_gvector_integer_destructor(cln::cl_heap*)
cln::cl_heap_GV<cln::cl_I>::~cl_heap_GV()
_ZN3cln10cl_heap_GVINS_4cl_IEED9Ev
cln::cl_GV_inner<cln::cl_I>::~cl_GV_inner()
_ZN3cln11cl_GV_innerINS_4cl_IEED9Ev
cln::cl_GV_inner<cln::cl_I>::operator delete(void*)
The pattern is always the same, as is the code that triggers it. For
example in cl_GV_I.cc:
static void cl_gvector_integer_destructor (cl_heap* pointer)
{
(*(cl_heap_GV_I*)pointer).~cl_heap_GV_I();
}
What I find irritating is that the dtors call their objects' operator
delete(void*). Isn't that hazardous?
Regards
-richy.
--
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cln/ChangeLog,v
retrieving revision 1.116
diff -a -u -r1.116 ChangeLog
--- ChangeLog 28 Nov 2004 21:07:37 -0000 1.116
+++ ChangeLog 28 Nov 2004 23:07:19 -0000
@@ -1,3 +1,37 @@
+2004-11-29 Ralf Wildenhues <wildenhues at ins.uni-bonn.de>
+ Richard B. Kreckel <kreckel at ginac.de>
+
+ Symmetrize operators new/delete
+ * include/cln/GV.h (cl_GV_inner): Add operators delete.
+ * include/cln/object.h (cl_gcobject, cl_gcpointer,
+ cl_rcobject, cl_rcpointer): Likewise.
+ * include/cln/SV.h (cl_SF_inner): Add placement delete.
+ * include/cln/complex_class.h (cl_N): Likewise.
+ * include/cln/sfloat_class.h (cl_SF): Likewise.
+ * include/cln/ffloat_class.h (cl_FF): Likewise.
+ * include/cln/dfloat_class.h (cl_DF): Likewise.
+ * include/cln/lfloat_class.h (cl_LF): Likewise.
+ * include/cln/float_class.h (cl_F): Likewise.
+ * include/cln/integer_class.h (cl_I): Likewise.
+ * include/cln/rational_class.h (cl_RA): Likewise.
+ * include/cln/real_class.h (cl_R): Likewise.
+ * include/cln/ring.h (_cl_ring_element, cl_ring_element):
+ Likewise.
+ * include/cln/modinteger.h (_cl_MI, cl_MI): Likewise.
+ * include/cln/univpoly.h (_cl_UP, cl_UP): Likewise.
+ * include/cln/univpoly_modint.h (cl_UP_MI): Likewise.
+ * include/cln/univpoly_complex.h (cl_UP_N): Likewise.
+ * include/cln/univpoly_real.h (cl_UP_R): Likewise.
+ * include/cln/univpoly_rational.h (cl_UP_RA): Likewise.
+ * include/cln/univpoly_integer.h (cl_UP_I): Likewise.
+ * src/base/cl_macros.h (ALLOCATE_ANYWHERE): Add placement delete and
+ remove obsolete `classname' argument.
+ * src/integer/conv/cl_I_to_digits.cc: Adjust ALLOCATE_ANYWHERE usage.
+ * src/base/hash/cl_hash1.h: Likewise.
+ * src/base/hash/cl_hash2.h: Likewise.
+ * src/base/hash/cl_hashset.h: Likewise.
+ * src/base/hash/cl_hashuniq.h: Likewise.
+
2004-11-28 Richard B. Kreckel <kreckel at ginac.de>
Disambiguate binary operators of CLN types with float/double
Index: include/cln/GV.h
===================================================================
RCS file: /home/cvs/cln/include/cln/GV.h,v
retrieving revision 1.4
diff -a -u -r1.4 GV.h
--- include/cln/GV.h 23 Jun 2004 21:11:21 -0000 1.4
+++ include/cln/GV.h 28 Nov 2004 23:07:20 -0000
@@ -44,14 +44,15 @@
// Destructor.
~cl_GV_inner ();
// Ability to place an object at a given address.
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
private:
-// No default constructor, copy constructor, assignment operator, new.
+// No default constructor, copy constructor, assignment operator, new, delete.
cl_GV_inner ();
cl_GV_inner (const cl_GV_inner&);
cl_GV_inner& operator= (const cl_GV_inner&);
- void* operator new (size_t size)
- { (void)size; return (void*)1; } // SGI CC needs this definition
+ void* operator new (size_t size);
+ void operator delete (void* ptr);
// Friend declarations. They are for the compiler. Just ignore them.
friend class cl_GV_index<T>;
friend class cl_GV_constindex<T>;
Index: include/cln/SV.h
===================================================================
RCS file: /home/cvs/cln/include/cln/SV.h,v
retrieving revision 1.4
diff -a -u -r1.4 SV.h
--- include/cln/SV.h 23 Jun 2004 21:11:21 -0000 1.4
+++ include/cln/SV.h 28 Nov 2004 23:07:21 -0000
@@ -81,13 +81,15 @@
// Destructor.
~cl_SV_inner ();
// Ability to place an object at a given address.
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
private:
-// No default constructor, copy constructor, assignment operator, new.
+// No default constructor, copy constructor, assignment operator, new, delete.
cl_SV_inner ();
cl_SV_inner (const cl_SV_inner&);
cl_SV_inner& operator= (const cl_SV_inner&);
void* operator new (size_t size);
+ void operator delete (void* ptr);
};
// All member functions are inline.
Index: include/cln/complex_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/complex_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 complex_class.h
--- include/cln/complex_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/complex_class.h 28 Nov 2004 23:07:21 -0000
@@ -34,10 +34,13 @@
// Private constructor.
cl_N (cl_private_thing);
cl_N (struct cl_heap_complex *);
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
private:
// Friend declarations. They are for the compiler. Just ignore them.
};
Index: include/cln/dfloat_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/dfloat_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 dfloat_class.h
--- include/cln/dfloat_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/dfloat_class.h 28 Nov 2004 23:07:21 -0000
@@ -29,10 +29,13 @@
cl_DF (struct cl_heap_dfloat *);
// Private pointer manipulations.
operator struct cl_heap_dfloat * () const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
private:
// Friend declarations. They are for the compiler. Just ignore them.
};
Index: include/cln/ffloat_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/ffloat_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 ffloat_class.h
--- include/cln/ffloat_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/ffloat_class.h 28 Nov 2004 23:07:21 -0000
@@ -37,10 +37,13 @@
// Private pointer manipulations.
operator struct cl_heap_ffloat * () const;
#endif
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
// Private constructors.
Index: include/cln/float_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/float_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 float_class.h
--- include/cln/float_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/float_class.h 28 Nov 2004 23:07:21 -0000
@@ -26,11 +26,13 @@
cl_F (const char *);
// Private constructor.
cl_F (cl_private_thing);
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
-private:
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }private:
// Friend declarations. They are for the compiler. Just ignore them.
};
Index: include/cln/integer_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/integer_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 integer_class.h
--- include/cln/integer_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/integer_class.h 28 Nov 2004 23:07:21 -0000
@@ -31,10 +31,13 @@
cl_I (cl_private_thing);
cl_I (struct cl_fixnum * /* NULL! */, cl_uint);
cl_I (struct cl_heap_bignum *);
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
// Private constructors.
Index: include/cln/lfloat_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/lfloat_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 lfloat_class.h
--- include/cln/lfloat_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/lfloat_class.h 28 Nov 2004 23:07:22 -0000
@@ -26,10 +26,13 @@
cl_LF (struct cl_heap_lfloat *);
// Private pointer manipulations.
operator struct cl_heap_lfloat * () const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
// Define this if you want the elementary cl_LF operations (+, -, *, /,
// sqrt, cl_LF_I_mul) to return results which are always the correctly
Index: include/cln/modinteger.h
===================================================================
RCS file: /home/cvs/cln/include/cln/modinteger.h,v
retrieving revision 1.5
diff -a -u -r1.5 modinteger.h
--- include/cln/modinteger.h 6 May 2002 10:29:18 -0000 1.5
+++ include/cln/modinteger.h 28 Nov 2004 23:07:23 -0000
@@ -101,10 +101,13 @@
public:
// Conversion.
CL_DEFINE_CONVERTER(_cl_ring_element)
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_MI /* cf. cl_ring_element */ : public _cl_MI {
@@ -123,10 +126,13 @@
CL_DEFINE_CONVERTER(cl_ring_element)
// Debugging output.
void debug_print () const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
Index: include/cln/object.h
===================================================================
RCS file: /home/cvs/cln/include/cln/object.h,v
retrieving revision 1.10
diff -a -u -r1.10 object.h
--- include/cln/object.h 27 Sep 2004 20:14:44 -0000 1.10
+++ include/cln/object.h 28 Nov 2004 23:07:24 -0000
@@ -334,9 +334,12 @@
#endif
// Debugging output.
void debug_print () const;
-// Ability to place an object at a given address.
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
+// Heap allocation/deallocation.
void* operator new (size_t size) { return ::operator new (size); }
+ void operator delete (void* ptr) { ::operator delete (ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
inline cl_gcobject::cl_gcobject () {}
inline cl_gcobject::~cl_gcobject () { cl_dec_refcount(*this); }
@@ -384,9 +387,12 @@
#endif
// Debugging output.
void debug_print () const;
-// Ability to place an object at a given address.
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
+// Heap allocation/deallocation.
void* operator new (size_t size) { return ::operator new (size); }
+ void operator delete (void* ptr) { ::operator delete (ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
inline cl_gcpointer::cl_gcpointer () {}
inline cl_gcpointer::~cl_gcpointer () { cl_dec_refcount(*this); }
@@ -434,9 +440,12 @@
#endif
// Debugging output.
void debug_print () const;
-// Ability to place an object at a given address.
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
+// Heap allocation/deallocation.
void* operator new (size_t size) { return ::operator new (size); }
+ void operator delete (void* ptr) { ::operator delete (ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
inline cl_rcobject::cl_rcobject () {}
inline cl_rcobject::~cl_rcobject () { cl_dec_refcount(*this); }
@@ -484,9 +493,12 @@
#endif
// Debugging output.
void debug_print () const;
-// Ability to place an object at a given address.
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
+// Heap allocation/deallocation.
void* operator new (size_t size) { return ::operator new (size); }
+ void operator delete (void* ptr) { ::operator delete (ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
inline cl_rcpointer::cl_rcpointer () {}
inline cl_rcpointer::~cl_rcpointer () { cl_dec_refcount(*this); }
Index: include/cln/rational_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/rational_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 rational_class.h
--- include/cln/rational_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/rational_class.h 28 Nov 2004 23:07:24 -0000
@@ -31,10 +31,13 @@
// Private constructor.
cl_RA (cl_private_thing);
cl_RA (struct cl_heap_ratio *);
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
private:
// Friend declarations. They are for the compiler. Just ignore them.
};
Index: include/cln/real_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/real_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 real_class.h
--- include/cln/real_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/real_class.h 28 Nov 2004 23:07:24 -0000
@@ -34,10 +34,13 @@
cl_R (const char *);
// Private constructor.
cl_R (cl_private_thing);
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
private:
// Friend declarations. They are for the compiler. Just ignore them.
};
Index: include/cln/ring.h
===================================================================
RCS file: /home/cvs/cln/include/cln/ring.h,v
retrieving revision 1.4
diff -a -u -r1.4 ring.h
--- include/cln/ring.h 6 May 2002 10:29:18 -0000 1.4
+++ include/cln/ring.h 28 Nov 2004 23:07:25 -0000
@@ -119,10 +119,13 @@
// Constructor.
_cl_ring_element (const cl_heap_ring* R, const cl_gcobject& r) : rep (as_cl_private_thing(r)) { (void)R; }
_cl_ring_element (const cl_ring& R, const cl_gcobject& r) : rep (as_cl_private_thing(r)) { (void)R; }
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_ring_element : public _cl_ring_element {
@@ -138,10 +141,12 @@
cl_ring_element (const cl_ring& R, const _cl_ring_element& r) : _cl_ring_element (r), _ring (R) {}
public: // Debugging output.
void debug_print () const;
- // Ability to place an object at a given address.
+ // Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+ // Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
// The ring operations are encoded as vectors of function pointers. You
Index: include/cln/sfloat_class.h
===================================================================
RCS file: /home/cvs/cln/include/cln/sfloat_class.h,v
retrieving revision 1.2
diff -a -u -r1.2 sfloat_class.h
--- include/cln/sfloat_class.h 22 Jan 2001 13:13:41 -0000 1.2
+++ include/cln/sfloat_class.h 28 Nov 2004 23:07:25 -0000
@@ -24,10 +24,13 @@
// Private constructor.
cl_SF (cl_private_thing);
cl_SF (struct cl_sfloat * /* NULL! */, cl_uint);
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
// Private constructors.
Index: include/cln/univpoly.h
===================================================================
RCS file: /home/cvs/cln/include/cln/univpoly.h,v
retrieving revision 1.5
diff -a -u -r1.5 univpoly.h
--- include/cln/univpoly.h 1 Jan 2004 15:59:30 -0000 1.5
+++ include/cln/univpoly.h 28 Nov 2004 23:07:27 -0000
@@ -70,10 +70,13 @@
public:
// Conversion.
CL_DEFINE_CONVERTER(_cl_ring_element)
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_UP /* cf. cl_ring_element */ : public _cl_UP {
@@ -100,10 +103,13 @@
const cl_ring_element operator() (const cl_ring_element& y) const;
// Debugging output.
void debug_print () const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
Index: include/cln/univpoly_complex.h
===================================================================
RCS file: /home/cvs/cln/include/cln/univpoly_complex.h,v
retrieving revision 1.4
diff -a -u -r1.4 univpoly_complex.h
--- include/cln/univpoly_complex.h 1 Jan 2004 15:59:30 -0000 1.4
+++ include/cln/univpoly_complex.h 28 Nov 2004 23:07:27 -0000
@@ -51,10 +51,13 @@
void finalize();
// Evaluation.
const cl_N operator() (const cl_N& y) const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_heap_univpoly_complex_ring : public cl_heap_univpoly_ring {
Index: include/cln/univpoly_integer.h
===================================================================
RCS file: /home/cvs/cln/include/cln/univpoly_integer.h,v
retrieving revision 1.4
diff -a -u -r1.4 univpoly_integer.h
--- include/cln/univpoly_integer.h 1 Jan 2004 15:59:30 -0000 1.4
+++ include/cln/univpoly_integer.h 28 Nov 2004 23:07:27 -0000
@@ -50,10 +50,13 @@
void finalize();
// Evaluation.
const cl_I operator() (const cl_I& y) const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_heap_univpoly_integer_ring : public cl_heap_univpoly_ring {
Index: include/cln/univpoly_modint.h
===================================================================
RCS file: /home/cvs/cln/include/cln/univpoly_modint.h,v
retrieving revision 1.4
diff -a -u -r1.4 univpoly_modint.h
--- include/cln/univpoly_modint.h 1 Jan 2004 15:59:30 -0000 1.4
+++ include/cln/univpoly_modint.h 28 Nov 2004 23:07:28 -0000
@@ -41,10 +41,13 @@
void finalize();
// Evaluation.
const cl_MI operator() (const cl_MI& y) const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_heap_univpoly_modint_ring : public cl_heap_univpoly_ring {
Index: include/cln/univpoly_rational.h
===================================================================
RCS file: /home/cvs/cln/include/cln/univpoly_rational.h,v
retrieving revision 1.4
diff -a -u -r1.4 univpoly_rational.h
--- include/cln/univpoly_rational.h 1 Jan 2004 15:59:30 -0000 1.4
+++ include/cln/univpoly_rational.h 28 Nov 2004 23:07:28 -0000
@@ -51,10 +51,13 @@
void finalize();
// Evaluation.
const cl_RA operator() (const cl_RA& y) const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_heap_univpoly_rational_ring : public cl_heap_univpoly_ring {
Index: include/cln/univpoly_real.h
===================================================================
RCS file: /home/cvs/cln/include/cln/univpoly_real.h,v
retrieving revision 1.4
diff -a -u -r1.4 univpoly_real.h
--- include/cln/univpoly_real.h 1 Jan 2004 15:59:30 -0000 1.4
+++ include/cln/univpoly_real.h 28 Nov 2004 23:07:29 -0000
@@ -51,10 +51,13 @@
void finalize();
// Evaluation.
const cl_R operator() (const cl_R& y) const;
-public: // Ability to place an object at a given address.
+public:
+// Heap allocation/deallocation.
void* operator new (size_t size) { return malloc_hook(size); }
- void* operator new (size_t size, void* ptr) { (void)size; return ptr; }
void operator delete (void* ptr) { free_hook(ptr); }
+// Ability to place an object at a given address.
+ void* operator new (size_t size, void* place) { (void)size; return place; }
+ void operator delete (void* ptr, void* place) { (void)ptr; (void)place; }
};
class cl_heap_univpoly_real_ring : public cl_heap_univpoly_ring {
Index: src/base/cl_macros.h
===================================================================
RCS file: /home/cvs/cln/src/base/cl_macros.h,v
retrieving revision 1.5
diff -a -u -r1.5 cl_macros.h
--- src/base/cl_macros.h 30 Jun 2004 21:51:32 -0000 1.5
+++ src/base/cl_macros.h 28 Nov 2004 23:07:31 -0000
@@ -244,22 +244,14 @@
// Inside a class definition:
// Overload `new' so that a class object can be allocated anywhere.
-#if !((defined(__rs6000__) || defined(__alpha__)) && !defined(__GNUC__))
-#define ALLOCATE_ANYWHERE(classname) \
- /* Ability to place an object at a given address. */ \
+#define ALLOCATE_ANYWHERE() \
public: \
+ /* Heap allocation/deallocation. */ \
void* operator new (size_t size) { return malloc_hook(size); } \
- void* operator new (size_t size, classname* ptr) { unused size; return ptr; } \
- void operator delete (void* ptr) { free_hook(ptr); }
-#else
-// For some compilers, work around template problem with "classname".
-#define ALLOCATE_ANYWHERE(classname) \
+ void operator delete (void* ptr) { free_hook(ptr); } \
/* Ability to place an object at a given address. */ \
-public: \
- void* operator new (size_t size) { return malloc_hook(size); } \
- void* operator new (size_t size, void* ptr) { unused size; return ptr; } \
- void operator delete (void* ptr) { free_hook(ptr); }
-#endif
+ void* operator new (size_t size, void* place) { unused size; return place; } \
+ void operator delete (void* ptr, void* place) { unused ptr; unused place; }
// init1(type, object) (value);
// initializes `object' with `value', by calling `type''s constructor.
Index: src/base/hash/cl_hash1.h
===================================================================
RCS file: /home/cvs/cln/src/base/hash/cl_hash1.h,v
retrieving revision 1.5
diff -a -u -r1.5 cl_hash1.h
--- src/base/hash/cl_hash1.h 1 Aug 2003 16:39:16 -0000 1.5
+++ src/base/hash/cl_hash1.h 28 Nov 2004 23:07:31 -0000
@@ -18,7 +18,7 @@
template <class key1_type, class value_type>
struct cl_htentry1 {
- ALLOCATE_ANYWHERE(cl_htentry1)
+ ALLOCATE_ANYWHERE()
key1_type key;
value_type val;
const value_type& htvalue () { return val; }
Index: src/base/hash/cl_hash2.h
===================================================================
RCS file: /home/cvs/cln/src/base/hash/cl_hash2.h,v
retrieving revision 1.5
diff -a -u -r1.5 cl_hash2.h
--- src/base/hash/cl_hash2.h 1 Aug 2003 16:39:16 -0000 1.5
+++ src/base/hash/cl_hash2.h 28 Nov 2004 23:07:32 -0000
@@ -15,7 +15,7 @@
template <class key1_type, class key2_type, class value_type>
struct cl_htentry2 {
- ALLOCATE_ANYWHERE(cl_htentry2)
+ ALLOCATE_ANYWHERE()
key1_type key1;
key2_type key2;
value_type val;
Index: src/base/hash/cl_hashset.h
===================================================================
RCS file: /home/cvs/cln/src/base/hash/cl_hashset.h,v
retrieving revision 1.4
diff -a -u -r1.4 cl_hashset.h
--- src/base/hash/cl_hashset.h 1 Aug 2003 16:39:16 -0000 1.4
+++ src/base/hash/cl_hashset.h 28 Nov 2004 23:07:32 -0000
@@ -14,7 +14,7 @@
template <class key1_type>
struct cl_htsetentry {
- ALLOCATE_ANYWHERE(cl_htsetentry)
+ ALLOCATE_ANYWHERE()
key1_type key;
cl_htsetentry (const key1_type& k)
: key (k) {}
Index: src/base/hash/cl_hashuniq.h
===================================================================
RCS file: /home/cvs/cln/src/base/hash/cl_hashuniq.h,v
retrieving revision 1.5
diff -a -u -r1.5 cl_hashuniq.h
--- src/base/hash/cl_hashuniq.h 1 Aug 2003 16:39:16 -0000 1.5
+++ src/base/hash/cl_hashuniq.h 28 Nov 2004 23:07:33 -0000
@@ -19,7 +19,7 @@
template <class key1_type, class value_type>
struct cl_htuniqentry {
- ALLOCATE_ANYWHERE(cl_htuniqentry)
+ ALLOCATE_ANYWHERE()
value_type val;
const value_type& htvalue () { return val; }
cl_htuniqentry (const value_type& v)
Index: src/integer/conv/cl_I_to_digits.cc
===================================================================
RCS file: /home/cvs/cln/src/integer/conv/cl_I_to_digits.cc,v
retrieving revision 1.5
diff -a -u -r1.5 cl_I_to_digits.cc
--- src/integer/conv/cl_I_to_digits.cc 22 Oct 2004 21:06:36 -0000 1.5
+++ src/integer/conv/cl_I_to_digits.cc 28 Nov 2004 23:07:36 -0000
@@ -204,7 +204,7 @@
// Tabelle: enth?lt zu jeder Basis b (2 <= b <= 36)
// NULL oder einen Vektor von lazy berechneten b^(k*2^i) und 1/b^(k*2^i).
typedef struct cached_power_table_entry {
- ALLOCATE_ANYWHERE(cached_power_table_entry)
+ ALLOCATE_ANYWHERE()
cl_I base_pow; // 0 or b^(k*2^i)
#ifdef MUL_REPLACES_DIV
cl_I inv_base_pow; // if base_pow: floor(2^(2*integer_length(base_pow))/base_pow)
More information about the CLN-list
mailing list