[GRASS-SVN] r51637 - in grass/branches/develbranch_6: include/iostream lib/iostream

svn_grass at osgeo.org svn_grass at osgeo.org
Wed May 16 17:52:24 EDT 2012


Author: hamish
Date: 2012-05-16 14:52:24 -0700 (Wed, 16 May 2012)
New Revision: 51637

Modified:
   grass/branches/develbranch_6/include/iostream/minmaxheap.h
   grass/branches/develbranch_6/include/iostream/mm.h
   grass/branches/develbranch_6/lib/iostream/mm.cc
Log:
Backport C++ fixes from trunk:
 - Fix exception specifications for new/delete operators (Glynn, r50130)
 - Declare scope for fns, making g++ 4.7 happy (#1655, r51633)


Modified: grass/branches/develbranch_6/include/iostream/minmaxheap.h
===================================================================
--- grass/branches/develbranch_6/include/iostream/minmaxheap.h	2012-05-16 21:37:15 UTC (rev 51636)
+++ grass/branches/develbranch_6/include/iostream/minmaxheap.h	2012-05-16 21:52:24 UTC (rev 51637)
@@ -744,7 +744,7 @@
   //heap must be empty
   assert(this->size()==0);
   for (i = 0; !full() && i<n; i++) {
-    insert(arr[i]);
+    this->insert(arr[i]);
   }
   if (i < n) {
     assert(i == this->maxsize);
@@ -777,13 +777,13 @@
 
   if(old) {
 	HeapIndex n = this->size();
-	this->A = allocateHeap(this->maxsize);	/* allocate a new array */
+	this->A = this->allocateHeap(this->maxsize);  /* allocate a new array */
 	/* copy over the old values */
 	assert(this->maxsize > n);
 	for(HeapIndex i=0; i<=n; i++) {	/* why extra value? -RW */
 	  this->A[i] = old[i];
 	}	
-	freeHeap(old);				/* free up old storage */
+	this->freeHeap(old);			/* free up old storage */
   }
 
 }

Modified: grass/branches/develbranch_6/include/iostream/mm.h
===================================================================
--- grass/branches/develbranch_6/include/iostream/mm.h	2012-05-16 21:37:15 UTC (rev 51636)
+++ grass/branches/develbranch_6/include/iostream/mm.h	2012-05-16 21:52:24 UTC (rev 51637)
@@ -110,10 +110,10 @@
   void print();
 
   friend class mm_register_init;
-  friend void * operator new(size_t);
-  friend void * operator new[](size_t);
-  friend void operator delete(void *);
-  friend void operator delete[](void *);
+  friend void * operator new(size_t) throw(std::bad_alloc);
+  friend void * operator new[](size_t) throw(std::bad_alloc);
+  friend void operator delete(void *) throw();
+  friend void operator delete[](void *) throw();
 };
 
 

Modified: grass/branches/develbranch_6/lib/iostream/mm.cc
===================================================================
--- grass/branches/develbranch_6/lib/iostream/mm.cc	2012-05-16 21:37:15 UTC (rev 51636)
+++ grass/branches/develbranch_6/lib/iostream/mm.cc	2012-05-16 21:52:24 UTC (rev 51637)
@@ -256,7 +256,7 @@
 
  
 /* ************************************************************ */
-void* operator new[] (size_t sz) {
+void* operator new[] (size_t sz) throw(std::bad_alloc) {
   void *p;
   
   MM_DEBUG cout << "new: sz=" << sz << ", register " 
@@ -307,7 +307,7 @@
 
  
 /* ************************************************************ */
-void* operator new (size_t sz) {
+void* operator new (size_t sz) throw(std::bad_alloc) {
   void *p;
   
   MM_DEBUG cout << "new: sz=" << sz << ", register " 
@@ -359,7 +359,7 @@
 
 
 /* ---------------------------------------------------------------------- */
-void operator delete (void *ptr)  {
+void operator delete (void *ptr) throw() {
   size_t sz;
   void *p;
   
@@ -399,7 +399,7 @@
 
 
 /* ---------------------------------------------------------------------- */
-void operator delete[] (void *ptr) {
+void operator delete[] (void *ptr) throw() {
   size_t sz;
   void *p;
   



More information about the grass-commit mailing list