diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index dba5632a..3fe6c845 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -100,7 +100,10 @@ The full set of tests is only run for tagged releases. - some selected clang -Weverything aspects - now -Wdocumentation clean (some wrong doxygen trailing comments) - use auto, emplace() and range loops - - use unique_ptr (also replace boost::scoped_ptr) + - use unique_ptr instead of free pointers, avoid explicit `delete` + - add and use move semantic in RlinkCommandExpect + - replace boost with std + - use std::unique_ptr instead of boost::scoped_ptr - rw11/shell.tcl: add workaround for tclreadline and `after` interference ### Bug Fixes diff --git a/tools/src/librlink/RlinkCommandExpect.hpp b/tools/src/librlink/RlinkCommandExpect.hpp index 9f882d8f..c3e64143 100644 --- a/tools/src/librlink/RlinkCommandExpect.hpp +++ b/tools/src/librlink/RlinkCommandExpect.hpp @@ -1,6 +1,6 @@ -// $Id: RlinkCommandExpect.hpp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RlinkCommandExpect.hpp 1077 2018-12-07 19:37:03Z mueller $ // -// Copyright 2011-2017 by Walter F.J. Mueller +// Copyright 2011-2018 by Walter F.J. Mueller // // This program is free software; you may redistribute and/or modify it under // the terms of the GNU General Public License as published by the Free @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-07 1077 1.2.2 SetBlock: add move versions // 2017-04-07 868 1.2.1 Dump(): add detail arg // 2015-04-02 661 1.2 expect logic: remove stat from Expect, invert mask // 2014-12-20 616 1.1 add Done count methods (for rblk/wblk) @@ -47,8 +48,11 @@ namespace Retro { void SetData(uint16_t data, uint16_t datamsk=0); void SetDone(uint16_t done, bool check=true); void SetBlock(const std::vector& block); + void SetBlock(std::vector&& block); void SetBlock(const std::vector& block, const std::vector& blockmsk); + void SetBlock(std::vector&& block, + std::vector&& blockmsk); uint16_t DataValue() const; uint16_t DataMask() const; diff --git a/tools/src/librlink/RlinkCommandExpect.ipp b/tools/src/librlink/RlinkCommandExpect.ipp index 765ed22c..75b133c5 100644 --- a/tools/src/librlink/RlinkCommandExpect.ipp +++ b/tools/src/librlink/RlinkCommandExpect.ipp @@ -1,4 +1,4 @@ -// $Id: RlinkCommandExpect.ipp 983 2018-01-02 20:35:59Z mueller $ +// $Id: RlinkCommandExpect.ipp 1077 2018-12-07 19:37:03Z mueller $ // // Copyright 2011-2015 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-07 1077 1.2.1 SetBlock: add move versions // 2015-04-02 661 1.2 expect logic: remove stat from Expect, invert mask // 2014-12-20 616 1.1 add Done count methods (for rblk/wblk) // 2011-03-12 368 1.0 Initial version @@ -53,6 +54,17 @@ inline void RlinkCommandExpect::SetDone(uint16_t done, bool check) inline void RlinkCommandExpect::SetBlock(const std::vector& block) { fBlockVal = block; + fBlockMsk.clear(); + return; +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + +inline void RlinkCommandExpect::SetBlock(std::vector&& block) +{ + fBlockVal = move(block); + fBlockMsk.clear(); return; } @@ -71,6 +83,17 @@ inline void RlinkCommandExpect::SetBlock( //------------------------------------------+----------------------------------- //! FIXME_docs +inline void RlinkCommandExpect::SetBlock(std::vector&& block, + std::vector&& blockmsk) +{ + fBlockVal = move(block); + fBlockMsk = move(blockmsk); + return; +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + inline uint16_t RlinkCommandExpect::DataValue() const { return fDataVal; diff --git a/tools/src/librlink/RlinkCommandList.cpp b/tools/src/librlink/RlinkCommandList.cpp index 0513f65c..c807ff89 100644 --- a/tools/src/librlink/RlinkCommandList.cpp +++ b/tools/src/librlink/RlinkCommandList.cpp @@ -1,4 +1,4 @@ -// $Id: RlinkCommandList.cpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RlinkCommandList.cpp 1077 2018-12-07 19:37:03Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-07 1077 1.4.1 SetLastExpectBlock: add move versions // 2018-12-01 1076 1.4 use unique_ptr // 2018-10-28 1062 1.3.3 replace boost/foreach // 2018-09-16 1047 1.3.2 coverity fixup (uninitialized scalar) @@ -249,8 +250,21 @@ void RlinkCommandList::SetLastExpectBlock(const std::vector& block) //------------------------------------------+----------------------------------- //! FIXME_docs - void RlinkCommandList::SetLastExpectBlock(const std::vector& block, - const std::vector& blockmsk) +void RlinkCommandList::SetLastExpectBlock(std::vector&& block) +{ + if (fList.empty()) + throw Rexception("RlinkCommandList::SetLastExpectBlock()", + "Bad state: list empty"); + RlinkCommand& cmd = *fList.back(); + cmd.EnsureExpect().SetBlock(move(block)); + return; +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + +void RlinkCommandList::SetLastExpectBlock(const std::vector& block, + const std::vector& blockmsk) { if (fList.empty()) throw Rexception("RlinkCommandList::SetLastExpectBlock()", @@ -263,6 +277,20 @@ void RlinkCommandList::SetLastExpectBlock(const std::vector& block) //------------------------------------------+----------------------------------- //! FIXME_docs +void RlinkCommandList::SetLastExpectBlock(std::vector&& block, + std::vector&& blockmsk) +{ + if (fList.empty()) + throw Rexception("RlinkCommandList::SetLastExpectBlock()", + "Bad state: list empty"); + RlinkCommand& cmd = *fList.back(); + cmd.EnsureExpect().SetBlock(move(block), move(blockmsk)); + return; +} + +//------------------------------------------+----------------------------------- +//! FIXME_docs + void RlinkCommandList::SetLastExpect(exp_uptr_t&& upexp) { if (fList.empty()) diff --git a/tools/src/librlink/RlinkCommandList.hpp b/tools/src/librlink/RlinkCommandList.hpp index 7f34affb..79b596a8 100644 --- a/tools/src/librlink/RlinkCommandList.hpp +++ b/tools/src/librlink/RlinkCommandList.hpp @@ -1,4 +1,4 @@ -// $Id: RlinkCommandList.hpp 1076 2018-12-02 12:45:49Z mueller $ +// $Id: RlinkCommandList.hpp 1077 2018-12-07 19:37:03Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-07 1077 1.4.1 SetLastExpectBlock: add move versions // 2018-12-01 1076 1.4 use unique_ptr // 2017-04-02 865 1.3.1 Dump(): add detail arg // 2015-04-02 661 1.3 expect logic: add SetLastExpect methods @@ -71,8 +72,11 @@ namespace Retro { void SetLastExpectData(uint16_t data, uint16_t datamsk=0xffff); void SetLastExpectDone(uint16_t done); void SetLastExpectBlock(const std::vector& block); + void SetLastExpectBlock(std::vector&& block); void SetLastExpectBlock(const std::vector& block, const std::vector& blockmsk); + void SetLastExpectBlock(std::vector&& block, + std::vector&& blockmsk); void SetLastExpect(exp_uptr_t&& upexp); void ClearLaboIndex(); diff --git a/tools/src/librlinktpp/RtclRlinkConnect.cpp b/tools/src/librlinktpp/RtclRlinkConnect.cpp index 26a37854..543b089f 100644 --- a/tools/src/librlinktpp/RtclRlinkConnect.cpp +++ b/tools/src/librlinktpp/RtclRlinkConnect.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRlinkConnect.cpp 1070 2018-11-17 09:48:04Z mueller $ +// $Id: RtclRlinkConnect.cpp 1077 2018-12-07 19:37:03Z mueller $ // // Copyright 2011-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-07 1077 1.6.3 use SetLastExpectBlock move semantics // 2018-11-16 1070 1.6.2 use auto; use range loop // 2018-09-16 1047 1.6.1 coverity fixup (uninitialized scalar) // 2017-04-29 888 1.6 drop M_rawio; add M_rawread,M_rawrblk,M_rawwblk @@ -304,7 +305,7 @@ int RtclRlinkConnect::M_exec(RtclArgs& args) size_t bsize = clist[lsize-1].BlockSize(); if (!args.GetArg("data", data, 0, bsize)) return kERR; if (!args.GetArg("??mask", mask, 0, bsize)) return kERR; - clist.SetLastExpectBlock(data, mask); + clist.SetLastExpectBlock(move(data), move(mask)); } else { uint16_t data=0; uint16_t mask=0xffff; diff --git a/tools/src/librwxxtpp/RtclRw11Cpu.cpp b/tools/src/librwxxtpp/RtclRw11Cpu.cpp index df0b3d3a..c9f3b67c 100644 --- a/tools/src/librwxxtpp/RtclRw11Cpu.cpp +++ b/tools/src/librwxxtpp/RtclRw11Cpu.cpp @@ -1,4 +1,4 @@ -// $Id: RtclRw11Cpu.cpp 1070 2018-11-17 09:48:04Z mueller $ +// $Id: RtclRw11Cpu.cpp 1077 2018-12-07 19:37:03Z mueller $ // // Copyright 2013-2018 by Walter F.J. Mueller // @@ -13,6 +13,7 @@ // // Revision History: // Date Rev Version Comment +// 2018-12-07 1077 1.2.20 use SetLastExpectBlock move semantics // 2018-11-16 1070 1.2.19 use auto; use emplace_back; use range loop // 2018-09-23 1050 1.2.18 add HasPcnt() // 2018-09-21 1048 1.2.18 coverity fixup (uninitialized scalar) @@ -669,7 +670,7 @@ int RtclRw11Cpu::M_cp(RtclArgs& args) size_t bsize = clist[lsize-1].BlockSize(); if (!args.GetArg("data", data, 0, bsize)) return kERR; if (!args.GetArg("??mask", mask, 0, bsize)) return kERR; - clist.SetLastExpectBlock(data, mask); + clist.SetLastExpectBlock(move(data), move(mask)); } else { uint16_t data=0; uint16_t mask=0xffff;