OSDN Git Service

Update to accommodate C++11 deprecation of "auto_ptr".
authorKeith Marshall <keith@users.osdn.me>
Sun, 13 Oct 2019 12:38:06 +0000 (13:38 +0100)
committerKeith Marshall <keith@users.osdn.me>
Sun, 13 Oct 2019 12:38:06 +0000 (13:38 +0100)
ChangeLog
tests/xmlcheck.cpp

index 20fcbce..c8b76dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2019-10-13  Keith Marshall  <keith@users.osdn.me>
+
+       Update to accommodate C++11 deprecation of "auto_ptr".
+
+       * tests/xmlcheck.cpp (unique_or_auto_ptr): New macro; define it...
+       [__cplusplus >= 201103L]: ...as "unique_ptr", for C++11 onward, or...
+       [__cplusplus < 201103L]: ...as "auto_ptr", for earlier C++.
+
 2019-07-06  Keith Marshall  <keith@users.osdn.me>
 
        Publish MinGW.org WSL-5.2.2 package set.
index aea0323..94725cf 100644 (file)
@@ -16,7 +16,7 @@
  *
  *
  * Adaptation by Keith Marshall <keithmarshall@users.sourceforge.net>
- * Copyright (C) 2013, MinGW.org Project
+ * Copyright (C) 2013, 2019, MinGW.org Project
  *
  * This is free software.  Permission is granted to copy, modify and
  * redistribute this software, under the provisions of the GNU General
 
 #include <libgen.h>     /* for basename()    */
 
+#if __cplusplus >= 201103L
+/* C++11 deprecates auto_ptr, in favour of shared_ptr or unique_ptr;
+ * prefer the latter alternative, in this case.
+ */
+#define unique_or_auto_ptr  unique_ptr
+#else
+/* Using a pre-C++11 compiler; must still use auto_ptr
+ */
+#define unique_or_auto_ptr  auto_ptr
+#endif
+
 #include <xercesc/util/XMLUni.hpp>
 #include <xercesc/util/XMLString.hpp>
 #include <xercesc/util/PlatformUtils.hpp>
@@ -267,7 +278,7 @@ validation_status( int argc, char **argv )
   /* Initialize a grammer pool, for use by our parser instances.
    */
   MemoryManager* mm( XMLPlatformUtils::fgMemoryManager );
-  auto_ptr<XMLGrammarPool> gp( new XMLGrammarPoolImpl( mm ) );
+  unique_or_auto_ptr<XMLGrammarPool> gp( new XMLGrammarPoolImpl( mm ) );
 
   /* Load the schema definitions into the grammar pool.
    */