Fix auto_ptr deprecated warnings when building with recent GCC.

(cherry picked from commit 78317a2799)
This commit is contained in:
Martin Whitaker 2018-10-06 17:15:31 +01:00
parent c5df4cfcad
commit 10fc8048ac
3 changed files with 27 additions and 15 deletions

View File

@ -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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -23,6 +23,10 @@
# include <typeinfo> # include <typeinfo>
# include "ivl_assert.h" # include "ivl_assert.h"
#if __cplusplus < 201103L
#define unique_ptr auto_ptr
#endif
using namespace std; using namespace std;
/* /*
@ -1018,7 +1022,7 @@ NetExpr* NetESignal::evaluate_function(const LineInfo&loc,
NetExpr* NetETernary::evaluate_function(const LineInfo&loc, NetExpr* NetETernary::evaluate_function(const LineInfo&loc,
map<perm_string,LocalVar>&context_map) const map<perm_string,LocalVar>&context_map) const
{ {
auto_ptr<NetExpr> cval (cond_->evaluate_function(loc, context_map)); unique_ptr<NetExpr> cval (cond_->evaluate_function(loc, context_map));
switch (const_logical(cval.get())) { switch (const_logical(cval.get())) {

View File

@ -1,7 +1,7 @@
#ifndef IVL_pform_types_H #ifndef IVL_pform_types_H
#define 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 * This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU * and/or modify it in source code form under the terms of the GNU
@ -33,6 +33,10 @@
# include <map> # include <map>
# include <memory> # include <memory>
#if __cplusplus < 201103L
#define unique_ptr auto_ptr
#endif
/* /*
* parse-form types. * parse-form types.
*/ */
@ -117,7 +121,7 @@ struct name_component_t {
struct decl_assignment_t { struct decl_assignment_t {
perm_string name; perm_string name;
std::list<pform_range_t>index; std::list<pform_range_t>index;
std::auto_ptr<PExpr> expr; std::unique_ptr<PExpr> expr;
}; };
struct pform_tf_port_t { struct pform_tf_port_t {
@ -170,14 +174,14 @@ struct enum_type_t : public data_type_t {
ivl_variable_type_t base_type; ivl_variable_type_t base_type;
bool signed_flag; bool signed_flag;
bool integer_flag; // True if "integer" was used bool integer_flag; // True if "integer" was used
std::auto_ptr< list<pform_range_t> > range; std::unique_ptr< list<pform_range_t> > range;
std::auto_ptr< list<named_pexpr_t> > names; std::unique_ptr< list<named_pexpr_t> > names;
LineInfo li; LineInfo li;
}; };
struct struct_member_t : public LineInfo { struct struct_member_t : public LineInfo {
std::auto_ptr<data_type_t> type; std::unique_ptr<data_type_t> type;
std::auto_ptr< list<decl_assignment_t*> > names; std::unique_ptr< list<decl_assignment_t*> > names;
void pform_dump(std::ostream&out, unsigned indent) const; 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 packed_flag;
bool union_flag; bool union_flag;
std::auto_ptr< list<struct_member_t*> > members; std::unique_ptr< list<struct_member_t*> > members;
}; };
struct atom2_type_t : public data_type_t { 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 reg_flag; // True if "reg" was used
bool integer_flag; // True if "integer" was used bool integer_flag; // True if "integer" was used
bool implicit_flag; // True if this type is implicitly logic/reg bool implicit_flag; // True if this type is implicitly logic/reg
std::auto_ptr< list<pform_range_t> > pdims; std::unique_ptr< list<pform_range_t> > pdims;
}; };
struct array_base_t : public data_type_t { 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) { } : base_type(btype), dims(pd) { }
data_type_t*base_type; data_type_t*base_type;
std::auto_ptr< list<pform_range_t> > dims; std::unique_ptr< list<pform_range_t> > dims;
}; };
/* /*

View File

@ -1,7 +1,7 @@
#ifndef IVL_expression_H #ifndef IVL_expression_H
#define 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), * Copyright CERN 2015 / Stephen Williams (steve@icarus.com),
* @author Maciej Suminski (maciej.suminski@cern.ch) * @author Maciej Suminski (maciej.suminski@cern.ch)
* *
@ -38,6 +38,10 @@ class VTypeArray;
class VTypePrimitive; class VTypePrimitive;
class ExpName; class ExpName;
#if __cplusplus < 201103L
#define unique_ptr auto_ptr
#endif
struct ExprVisitor { struct ExprVisitor {
virtual ~ExprVisitor() {}; virtual ~ExprVisitor() {};
virtual void operator() (Expression*s) = 0; virtual void operator() (Expression*s) = 0;
@ -255,8 +259,8 @@ class ExpAggregate : public Expression {
void dump(ostream&out, int indent) const; void dump(ostream&out, int indent) const;
private: private:
std::auto_ptr<Expression>expr_; std::unique_ptr<Expression>expr_;
std::auto_ptr<prange_t> range_; std::unique_ptr<prange_t> range_;
private: // not implemented private: // not implemented
choice_t& operator= (const choice_t&); choice_t& operator= (const choice_t&);
}; };
@ -718,7 +722,7 @@ class ExpName : public Expression {
const list<index_t*>&indices, int field_size); const list<index_t*>&indices, int field_size);
private: private:
std::auto_ptr<ExpName> prefix_; std::unique_ptr<ExpName> prefix_;
perm_string name_; perm_string name_;
Expression*index_; Expression*index_;
Expression*lsb_; Expression*lsb_;