[Debian-med-packaging] C++ help needed for centrifuge

Alexis Murzeau amubtdx at gmail.com
Sat Nov 25 21:32:53 UTC 2017


Le 25/11/2017 à 21:56, Andreas Tille a écrit :
> Hi,
> 
> I started packaging centrifuge[1] and hit a build error which
> is most probably caused by gcc-7 incompatibility:
> 
> ...
> In file included from centrifuge_build.cpp:27:0:
> bt2_idx.h: In static member function 'static std::pair<Ebwt<index_t>*, Ebwt<index_t>*> Ebwt<index_t>::fromStrings(const EList<std::__cxx11::basic_string<char> >&, bool, int, int, bool,     int32_t, int32_t, int32_t, const string&, bool, index_t, index_t, index_t, int, uint32_t, bool, bool, bool)':
> bt2_idx.h:1053:3: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
>    auto_ptr<stringstream> ss(new stringstream());
>    ^~~~~~~~
> In file included from /usr/include/c++/7/memory:80:0,
>                  from bt2_idx.h:28,
>                  from centrifuge_build.cpp:27:
> /usr/include/c++/7/bits/unique_ptr.h:51:28: note: declared here
>    template<typename> class auto_ptr;
>                             ^~~~~~~~
> In file included from centrifuge_build.cpp:27:0:
> bt2_idx.h:1057:3: warning: 'template<class> class std::auto_ptr' is deprecated [-Wdeprecated-declarations]
>    auto_ptr<FileBuf> fb(new FileBuf(ss.get()));
>    ^~~~~~~~
> In file included from /usr/include/c++/7/memory:80:0,
>                  from bt2_idx.h:28,
>                  from centrifuge_build.cpp:27:
> /usr/include/c++/7/bits/unique_ptr.h:51:28: note: declared here
>    template<typename> class auto_ptr;
> ...
> 

Hi,

You can replace auto_ptr with unique_ptr which was introduced with
C++11. std::unique_ptr is declared in the same header as auto_ptr
(<memory>).

One major difference is that std::unique_ptr cannot be copied but moved
instead.
For example:
std::unique_ptr<FileBuf> fb(new FileBuf);
std::unique_ptr<FileBuf> fb2 = std::move(p);

After that second line, p will be empty/null and p2 will contains the
FileBuf pointer.

But in bt2_idx.h, the auto_ptr variables are not copied around so you
probably just need to replace "auto_ptr" with "unique_ptr" and that's all.


-- 
Alexis Murzeau
PGP: B7E6 0EBB 9293 7B06 BDBC  2787 E7BD 1904 F480 937F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/debian-med-packaging/attachments/20171125/05f9fa09/attachment.sig>


More information about the Debian-med-packaging mailing list