[GRASS-SVN] r68988 - in grass/branches/releasebranch_6_4: include/iostream lib/iostream

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jul 16 11:01:34 PDT 2016


Author: neteler
Date: 2016-07-16 11:01:34 -0700 (Sat, 16 Jul 2016)
New Revision: 68988

Modified:
   grass/branches/releasebranch_6_4/include/iostream/mm.h
   grass/branches/releasebranch_6_4/lib/iostream/mm.cc
Log:
libiostream: use exception specifiers only for C++ versions older than C++11 (trunk, r68818)

Modified: grass/branches/releasebranch_6_4/include/iostream/mm.h
===================================================================
--- grass/branches/releasebranch_6_4/include/iostream/mm.h	2016-07-16 17:08:13 UTC (rev 68987)
+++ grass/branches/releasebranch_6_4/include/iostream/mm.h	2016-07-16 18:01:34 UTC (rev 68988)
@@ -21,6 +21,11 @@
 
 #include <sys/types.h>
 
+// GCC with C++98 and -fexceptions requires exception
+// specifiers, however with C++11 and newer, using them causes an error.
+#if __cplusplus < 201103L
+#define GRASS_MM_USE_EXCEPTION_SPECIFIER
+#endif /* __cplusplus < 201103L */
 
 #define MM_REGISTER_VERSION 2
 
@@ -110,10 +115,17 @@
   void print();
 
   friend class mm_register_init;
-  friend void * operator new(size_t) throw(std::bad_alloc);
-  friend void * operator new[](size_t) throw(std::bad_alloc);
+#ifdef GRASS_MM_USE_EXCEPTION_SPECIFIER
+  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();
+#else
+  friend void * operator new(size_t);
+  friend void * operator new[] (size_t);
+  friend void operator delete(void *) noexcept;
+  friend void operator delete[](void *) noexcept;
+#endif /* GRASS_MM_USE_EXCEPTION_SPECIFIER */
 };
 
 

Modified: grass/branches/releasebranch_6_4/lib/iostream/mm.cc
===================================================================
--- grass/branches/releasebranch_6_4/lib/iostream/mm.cc	2016-07-16 17:08:13 UTC (rev 68987)
+++ grass/branches/releasebranch_6_4/lib/iostream/mm.cc	2016-07-16 18:01:34 UTC (rev 68988)
@@ -1,22 +1,40 @@
 /****************************************************************************
  * 
- *  MODULE:	iostream
+ *  MODULE:     iostream
  *
+
  *  COPYRIGHT (C) 2007 Laura Toma
  *   
+ * 
+
+ *  Iostream is a library that implements streams, external memory
+ *  sorting on streams, and an external memory priority queue on
+ *  streams. These are the fundamental components used in external
+ *  memory algorithms.  
+
+ * Credits: The library was developed by Laura Toma.  The kernel of
+ * class STREAM is based on the similar class existent in the GPL TPIE
+ * project developed at Duke University. The sorting and priority
+ * queue have been developed by Laura Toma based on communications
+ * with Rajiv Wickremesinghe. The library was developed as part of
+ * porting Terraflow to GRASS in 2001.  PEARL upgrades in 2003 by
+ * Rajiv Wickremesinghe as part of the Terracost project.
+
+ * 
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
+
  *  This program is distributed in the hope that it will be useful,
  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *****************************************************************************/
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  General Public License for more details.  *
+ *  **************************************************************************/
 
 
+
 // A simple registration based memory manager.
 
 #include <stdio.h>
@@ -256,7 +274,11 @@
 
  
 /* ************************************************************ */
-void* operator new[] (size_t sz) throw(std::bad_alloc) {
+#ifdef GRASS_MM_USE_EXCEPTION_SPECIFIER
+void* operator new[] (size_t sz) throw (std::bad_alloc) {
+#else
+void* operator new[] (size_t sz) {
+#endif /* GRASS_MM_USE_EXCEPTION_SPECIFIER */
   void *p;
   
   MM_DEBUG cout << "new: sz=" << sz << ", register " 
@@ -307,7 +329,11 @@
 
  
 /* ************************************************************ */
-void* operator new (size_t sz) throw(std::bad_alloc) {
+#ifdef GRASS_MM_USE_EXCEPTION_SPECIFIER
+void* operator new (size_t sz) throw (std::bad_alloc) {
+#else
+void* operator new (size_t sz) {
+#endif /* GRASS_MM_USE_EXCEPTION_SPECIFIER */
   void *p;
   
   MM_DEBUG cout << "new: sz=" << sz << ", register " 
@@ -359,7 +385,11 @@
 
 
 /* ---------------------------------------------------------------------- */
+#ifdef GRASS_MM_USE_EXCEPTION_SPECIFIER
 void operator delete (void *ptr) throw() {
+#else
+void operator delete (void *ptr) noexcept {
+#endif /* GRASS_MM_USE_EXCEPTION_SPECIFIER */
   size_t sz;
   void *p;
   
@@ -399,7 +429,11 @@
 
 
 /* ---------------------------------------------------------------------- */
+#ifdef GRASS_MM_USE_EXCEPTION_SPECIFIER
 void operator delete[] (void *ptr) throw() {
+#else
+void operator delete[] (void *ptr) noexcept {
+#endif /* GRASS_MM_USE_EXCEPTION_SPECIFIER */
   size_t sz;
   void *p;
   



More information about the grass-commit mailing list