[ecflow] 13/50: update auto_ptr
Alastair McKinstry
mckinstry at moszumanska.debian.org
Wed Sep 20 15:30:42 UTC 2017
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository ecflow.
commit 4aa504480f54b66841790f52f9ad3460f9f38929
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Wed Mar 22 17:03:17 2017 +0000
update auto_ptr
---
debian/patches/auto_ptr.patch | 60 +++++++++++++++++++++++++++++++++++++++----
1 file changed, 55 insertions(+), 5 deletions(-)
diff --git a/debian/patches/auto_ptr.patch b/debian/patches/auto_ptr.patch
index 4538339..72beb5d 100644
--- a/debian/patches/auto_ptr.patch
+++ b/debian/patches/auto_ptr.patch
@@ -1,3 +1,8 @@
+Description: Drop auto_ptr (deprecated) for unique_ptr, shared_ptr
+Author: Alastair McKinstry <mckinstry at debian.org>
+Last-Updated: 2017-03-22
+Forwarded: no
+
Index: ecflow-4.5.0/ANode/src/ExprDuplicate.cpp
===================================================================
--- ecflow-4.5.0.orig/ANode/src/ExprDuplicate.cpp
@@ -85,7 +90,7 @@ Index: ecflow-4.5.0/ANode/src/Expression.cpp
if (errorMsg.empty()) LOG_ASSERT(ast.get(),"");
else LOG_ASSERT(!ast.get(), "");
-@@ -83,7 +83,7 @@ std::auto_ptr<AstTop> PartExpression::pa
+@@ -83,28 +83,28 @@ std::auto_ptr<AstTop> PartExpression::pa
return ast;
}
}
@@ -94,6 +99,31 @@ Index: ecflow-4.5.0/ANode/src/Expression.cpp
}
//===========================================================================
+
+ Expression::Expression(const std::string& expression)
+-: makeFree_(false), state_change_no_(0), theCombinedAst_(0)
++: makeFree_(false), state_change_no_(0) , theCombinedAst_(0)
+ {
+ add(PartExpression(expression));
+ }
+
+ Expression::Expression(const PartExpression& exp)
+-: makeFree_(false), state_change_no_(0),theCombinedAst_(0)
++: makeFree_(false), state_change_no_(0) ,theCombinedAst_(0)
+ {
+ add(exp);
+ }
+
+ Expression::Expression()
+-: makeFree_(false), state_change_no_(0), theCombinedAst_(0) {}
++: makeFree_(false), state_change_no_(0) , theCombinedAst_(0) {}
+
+ Expression::Expression(const Expression& rhs)
+-: vec_(rhs.vec_), makeFree_(rhs.makeFree_), state_change_no_(0),theCombinedAst_(0) {}
++: vec_(rhs.vec_), makeFree_(rhs.makeFree_), state_change_no_(0) ,theCombinedAst_(0) {}
+
+ std::ostream& Expression::print(std::ostream& os, const std::string& exprType) const
+ {
@@ -156,7 +156,7 @@ void Expression::createAST( Node* node,
size_t theSize = vec_.size();
for(size_t i = 0; i < theSize; i++) {
@@ -103,7 +133,7 @@ Index: ecflow-4.5.0/ANode/src/Expression.cpp
if ( ast.get() ) {
// We can have multiple trigger/complete expression, combine to a single AST tree
-@@ -183,7 +183,7 @@ void Expression::createAST( Node* node,
+@@ -183,13 +183,13 @@ void Expression::createAST( Node* node,
// Since we have transferred over root2 it must be set to NULL for top2,
// to avoid its child destruction
@@ -112,6 +142,13 @@ Index: ecflow-4.5.0/ANode/src/Expression.cpp
}
}
else {
+ // The very first expression should _NOT_ be AND/OR trigger. (i.e no -o | -a)
+ LOG_ASSERT((!vec_[i].andExpr()) && (!vec_[i].orExpr()), "");
+- theCombinedAst_ = ast; // transfer ownership
++ theCombinedAst_ = std::move(ast);
+ theCombinedAst_->exprType(exprType);
+ }
+ // cout << "****************************************************************\n";
Index: ecflow-4.5.0/ANode/src/ExprParser.hpp
===================================================================
--- ecflow-4.5.0.orig/ANode/src/ExprParser.hpp
@@ -130,7 +167,7 @@ Index: ecflow-4.5.0/ANode/src/ExprParser.hpp
/// return the Abstract syntax tree, and release memory
- std::auto_ptr<AstTop> ast() { return ast_;}
-+ std::unique_ptr<AstTop> ast() { return ast_;}
++ std::unique_ptr<AstTop> ast() { return std::move(ast_);}
/// return the Abstract syntax tree, without release memory
AstTop* getAst() const { return ast_.get();}
@@ -146,7 +183,7 @@ Index: ecflow-4.5.0/ANode/src/ExprParser.hpp
/// return the Abstract syntax tree, and release memory
- std::auto_ptr<AstTop> ast() { return ast_;}
-+ std::unique_ptr<AstTop> ast() { return ast_;}
++ std::unique_ptr<AstTop> ast() { return std::move(ast_);}
private:
const std::string& expr_;
@@ -257,7 +294,7 @@ Index: ecflow-4.5.0/ANode/src/Expression.hpp
// 1/ Help with AIX serialisation
// 2/ Help to reduce network traffic
- mutable std::auto_ptr< AstTop > theCombinedAst_; // *not* persisted, demand created
-+ mutable std::unique_ptr< AstTop > theCombinedAst_; // *not* persisted, demand created
++ mutable std::shared_ptr< AstTop > theCombinedAst_; // *not* persisted, demand created
private:
- // prevent assignment since we have an auto_ptr
@@ -287,3 +324,16 @@ Index: ecflow-4.5.0/ANode/test/TestExprParser.cpp
BOOST_REQUIRE_MESSAGE(ast.get(),"Failed to parse " << vec[i] << " " << parseErrorMsg);
std::stringstream s2;
+Index: ecflow-4.5.0/ANode/src/ExprParser.cpp
+===================================================================
+--- ecflow-4.5.0.orig/ANode/src/ExprParser.cpp
++++ ecflow-4.5.0/ANode/src/ExprParser.cpp
+@@ -962,7 +962,7 @@ AstTop* createAst(
+ std::cout << "\nPRINT_AST_TRAVERSAL " << expr << "\n";
+ #endif
+
+- std::auto_ptr<AstTop> ast(new AstTop);
++ std::unique_ptr<AstTop> ast(new AstTop);
+ (void)doCreateAst(info.trees.begin(),rule_names,ast.get() );
+
+ #if defined(PRINT_AST)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ecflow.git
More information about the debian-science-commits
mailing list