From 10fc8048acfc5b85dd34b9d64719fa63fcdd33bd Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Sat, 6 Oct 2018 17:15:31 +0100 Subject: [PATCH] Fix auto_ptr deprecated warnings when building with recent GCC. (cherry picked from commit 78317a2799260c9a5baa227ff1768a12a47f181b) --- net_func_eval.cc | 8 ++++++-- pform_types.h | 22 +++++++++++++--------- vhdlpp/expression.h | 12 ++++++++---- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/net_func_eval.cc b/net_func_eval.cc index 00790d692..f310af488 100644 --- a/net_func_eval.cc +++ b/net_func_eval.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2016 Stephen Williams (steve@icarus.com) + * Copyright (c) 2012-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -23,6 +23,10 @@ # include # include "ivl_assert.h" +#if __cplusplus < 201103L +#define unique_ptr auto_ptr +#endif + using namespace std; /* @@ -1018,7 +1022,7 @@ NetExpr* NetESignal::evaluate_function(const LineInfo&loc, NetExpr* NetETernary::evaluate_function(const LineInfo&loc, map&context_map) const { - auto_ptr cval (cond_->evaluate_function(loc, context_map)); + unique_ptr cval (cond_->evaluate_function(loc, context_map)); switch (const_logical(cval.get())) { diff --git a/pform_types.h b/pform_types.h index 22dab4b46..0bd87d817 100644 --- a/pform_types.h +++ b/pform_types.h @@ -1,7 +1,7 @@ #ifndef IVL_pform_types_H #define IVL_pform_types_H /* - * Copyright (c) 2007-2016 Stephen Williams (steve@icarus.com) + * Copyright (c) 2007-2018 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -33,6 +33,10 @@ # include # include +#if __cplusplus < 201103L +#define unique_ptr auto_ptr +#endif + /* * parse-form types. */ @@ -117,7 +121,7 @@ struct name_component_t { struct decl_assignment_t { perm_string name; std::listindex; - std::auto_ptr expr; + std::unique_ptr expr; }; struct pform_tf_port_t { @@ -170,14 +174,14 @@ struct enum_type_t : public data_type_t { ivl_variable_type_t base_type; bool signed_flag; bool integer_flag; // True if "integer" was used - std::auto_ptr< list > range; - std::auto_ptr< list > names; + std::unique_ptr< list > range; + std::unique_ptr< list > names; LineInfo li; }; struct struct_member_t : public LineInfo { - std::auto_ptr type; - std::auto_ptr< list > names; + std::unique_ptr type; + std::unique_ptr< list > names; void pform_dump(std::ostream&out, unsigned indent) const; }; @@ -188,7 +192,7 @@ struct struct_type_t : public data_type_t { bool packed_flag; bool union_flag; - std::auto_ptr< list > members; + std::unique_ptr< list > members; }; struct atom2_type_t : public data_type_t { @@ -234,7 +238,7 @@ struct vector_type_t : public data_type_t { bool reg_flag; // True if "reg" was used bool integer_flag; // True if "integer" was used bool implicit_flag; // True if this type is implicitly logic/reg - std::auto_ptr< list > pdims; + std::unique_ptr< list > pdims; }; struct array_base_t : public data_type_t { @@ -243,7 +247,7 @@ struct array_base_t : public data_type_t { : base_type(btype), dims(pd) { } data_type_t*base_type; - std::auto_ptr< list > dims; + std::unique_ptr< list > dims; }; /* diff --git a/vhdlpp/expression.h b/vhdlpp/expression.h index 553c6b9c4..303cdc063 100644 --- a/vhdlpp/expression.h +++ b/vhdlpp/expression.h @@ -1,7 +1,7 @@ #ifndef IVL_expression_H #define IVL_expression_H /* - * Copyright (c) 2011-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2011-2018 Stephen Williams (steve@icarus.com) * Copyright CERN 2015 / Stephen Williams (steve@icarus.com), * @author Maciej Suminski (maciej.suminski@cern.ch) * @@ -38,6 +38,10 @@ class VTypeArray; class VTypePrimitive; class ExpName; +#if __cplusplus < 201103L +#define unique_ptr auto_ptr +#endif + struct ExprVisitor { virtual ~ExprVisitor() {}; virtual void operator() (Expression*s) = 0; @@ -255,8 +259,8 @@ class ExpAggregate : public Expression { void dump(ostream&out, int indent) const; private: - std::auto_ptrexpr_; - std::auto_ptr range_; + std::unique_ptrexpr_; + std::unique_ptr range_; private: // not implemented choice_t& operator= (const choice_t&); }; @@ -718,7 +722,7 @@ class ExpName : public Expression { const list&indices, int field_size); private: - std::auto_ptr prefix_; + std::unique_ptr prefix_; perm_string name_; Expression*index_; Expression*lsb_;