From 7df31f68d9afd7c71cafdd9bb729571e6d6b29ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Wed, 9 Jan 2019 16:23:04 +0100 Subject: [PATCH] Port to C++ delete keyword Performed using modernize-use-equals-delete from clang-tidy. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-delete.html --- dynare++/parser/cc/dynamic_atoms.hh | 4 +--- dynare++/parser/cc/formula_parser.hh | 4 +--- dynare++/parser/cc/tree.hh | 3 +-- dynare++/src/forw_subst_builder.hh | 2 +- dynare++/src/planner_builder.hh | 4 ++-- dynare++/sylv/cc/SylvMemory.hh | 8 ++++---- dynare++/tl/cc/pyramid_prod2.hh | 3 +-- 7 files changed, 11 insertions(+), 17 deletions(-) diff --git a/dynare++/parser/cc/dynamic_atoms.hh b/dynare++/parser/cc/dynamic_atoms.hh index 05341f352..27800522d 100644 --- a/dynare++/parser/cc/dynamic_atoms.hh +++ b/dynare++/parser/cc/dynamic_atoms.hh @@ -357,6 +357,7 @@ namespace ogp } VarOrdering(const VarOrdering &vo, const vector &vnames, const DynamicAtoms &a); + VarOrdering(const VarOrdering &vo) = delete; virtual VarOrdering *clone(const vector &vnames, const DynamicAtoms &a) const = 0; /** Destructor does nothing here. */ @@ -462,9 +463,6 @@ namespace ogp * from the least to the most time preserving the order of atoms * within one time. */ void do_increasing_time(); - private: - /** Declare this copy constructor as private to hide it. */ - VarOrdering(const VarOrdering &vo); }; }; diff --git a/dynare++/parser/cc/formula_parser.hh b/dynare++/parser/cc/formula_parser.hh index e34f97980..448473545 100644 --- a/dynare++/parser/cc/formula_parser.hh +++ b/dynare++/parser/cc/formula_parser.hh @@ -158,6 +158,7 @@ namespace ogp : atoms(a) { } + FormulaParser(const FormulaParser &fp) = delete; /** Copy constructor using a different instance of Atoms. */ FormulaParser(const FormulaParser &fp, Atoms &a); virtual @@ -295,9 +296,6 @@ namespace ogp /** Debug print. */ void print() const; private: - /** Hide this copy constructor declaration by declaring it as - * private. */ - FormulaParser(const FormulaParser &fp); /** Destroy all derivatives. */ void destroy_derivatives(); }; diff --git a/dynare++/parser/cc/tree.hh b/dynare++/parser/cc/tree.hh index d81e29f7a..ea2ccd84c 100644 --- a/dynare++/parser/cc/tree.hh +++ b/dynare++/parser/cc/tree.hh @@ -403,6 +403,7 @@ namespace ogp * will contain only formulas up to the given last index * (included). */ EvalTree(const OperationTree &otree, int last = -1); + EvalTree(const EvalTree &) = delete; virtual ~EvalTree() { delete [] values; delete [] flags; @@ -422,8 +423,6 @@ namespace ogp { return otree; } - private: - EvalTree(const EvalTree &); }; /** This is an interface describing how a given operation is diff --git a/dynare++/src/forw_subst_builder.hh b/dynare++/src/forw_subst_builder.hh index 1b4b7b532..ea5775a7e 100644 --- a/dynare++/src/forw_subst_builder.hh +++ b/dynare++/src/forw_subst_builder.hh @@ -47,6 +47,7 @@ namespace ogdyn * function. This will save us many occurrences of other * variables involved in the equation. */ ForwSubstBuilder(DynareModel &m); + ForwSubstBuilder(const ForwSubstBuilder &b) = delete; /** Copy constructor with a new instance of the model. */ ForwSubstBuilder(const ForwSubstBuilder &b, DynareModel &m); /** Return the auxiliary variable mapping. */ @@ -62,7 +63,6 @@ namespace ogdyn return info; } private: - ForwSubstBuilder(const ForwSubstBuilder &b); /** This method takes a nonlinear term t, and if it has leads * of greater than 1, then it substitutes the term for the new * variable (or string of variables). Note that the diff --git a/dynare++/src/planner_builder.hh b/dynare++/src/planner_builder.hh index e1e08c669..b38e2eb2d 100644 --- a/dynare++/src/planner_builder.hh +++ b/dynare++/src/planner_builder.hh @@ -234,6 +234,8 @@ namespace ogdyn /** Construct a copy of the builder with provided model, which * is supposed to be the copy of the model in the builder. */ PlannerBuilder(const PlannerBuilder &pb, ogdyn::DynareModel &m); + /** Avoid copying from only PlannerBuilder. */ + PlannerBuilder(const PlannerBuilder &pb) = delete; /** Return the information. */ const PlannerInfo & get_info() const @@ -272,8 +274,6 @@ namespace ogdyn * aux_map_static. */ void fill_aux_map(const ogp::NameStorage &ns, const Tsubstmap &aaux_map, const Tsubstmap &astatic_aux_map); - /** Avoid copying from only PlannerBuilder. */ - PlannerBuilder(const PlannerBuilder &pb); }; /** This class only calculates for the given initial guess of diff --git a/dynare++/sylv/cc/SylvMemory.hh b/dynare++/sylv/cc/SylvMemory.hh index eaac9b613..6300c5da5 100644 --- a/dynare++/sylv/cc/SylvMemory.hh +++ b/dynare++/sylv/cc/SylvMemory.hh @@ -33,10 +33,10 @@ class SylvMemoryPool size_t length{0}; size_t allocated{0}; bool stack_mode{false}; - SylvMemoryPool(const SylvMemoryPool &); - const SylvMemoryPool &operator=(const SylvMemoryPool &); public: SylvMemoryPool(); + SylvMemoryPool(const SylvMemoryPool &) = delete; + const SylvMemoryPool &operator=(const SylvMemoryPool &) = delete; ~SylvMemoryPool(); void init(size_t size); void *allocate(size_t size); @@ -47,11 +47,11 @@ public: class SylvMemoryDriver { - SylvMemoryDriver(const SylvMemoryDriver &); - const SylvMemoryDriver &operator=(const SylvMemoryDriver &); public: SylvMemoryDriver(int num_d, int m, int n, int order); SylvMemoryDriver(const SylvParams &pars, int num_d, int m, int n, int order); + SylvMemoryDriver(const SylvMemoryDriver &) = delete; + const SylvMemoryDriver &operator=(const SylvMemoryDriver &) = delete; static void setStackMode(bool); ~SylvMemoryDriver(); protected: diff --git a/dynare++/tl/cc/pyramid_prod2.hh b/dynare++/tl/cc/pyramid_prod2.hh index 2dce7e1c5..a948fcb8a 100644 --- a/dynare++/tl/cc/pyramid_prod2.hh +++ b/dynare++/tl/cc/pyramid_prod2.hh @@ -101,6 +101,7 @@ class IrregTensorHeader IntSequence end_seq; public: IrregTensorHeader(const StackProduct &sp, const IntSequence &c); + IrregTensorHeader(const IrregTensorHeader &) = delete; ~IrregTensorHeader(); int dimen() const @@ -109,8 +110,6 @@ public: } void increment(IntSequence &v) const; int calcMaxOffset() const; -private: - IrregTensorHeader(const IrregTensorHeader &); }; /* Here we declare the irregular tensor. There is no special logic