Ticket Hash: | 97f62ef016ea3d71fffb3a110400b9b2477aff15 | |||
Title: | Convert auto_ptr in lib/refcounted.h to unique_ptr | |||
Status: | Closed | Type: | Build Problem | |
Severity: | Important | Priority: | Low | |
Subsystem: | Library | Resolution: | Fixed | |
Last Modified: | 2018-07-12 20:05:50 | |||
Version Found In: | 3.2.3 | |||
User Comments: | ||||
anonymous added on 2017-09-01 13:35:26:
The std::auto_ptr class template was deprecated in C++11, so GCC now warns about its usage. This warning can be suppressed with the -Wno-deprecated-declarations command-line option, though we advise to port the code to use C++11's std::unique_ptr instead. GCC 6 and above default to -std=gnu++14 so this warning is flagged. Please update to unique_ptr tangent added on 2017-09-08 17:26:31: MySQL++ must continue to build on systems without C++11 support until C++11 is "everywhere." Until then, we cannot unconditionally switch over to the new <memory> stuff, else we'd unnecessarily drop support for these older but still useful platforms. If you wish to provide a patch that conditionally switches the library to unique_ptr and such based on an autoconf test that determines that the build target supports it, we're happy to review it and will probably include it in the next version. anonymous added on 2018-05-02 15:38:33: Here is a proposed patch to add std::unique_ptr support: diff --git a/mysql++-3.2.3/lib/dbdriver.cpp b/mysql++-3.2.3/lib/dbdriver.cpp index 8d43d1a..73287c6 100644 --- a/mysql++-3.2.3/lib/dbdriver.cpp +++ b/mysql++-3.2.3/lib/dbdriver.cpp @@ -300,7 +300,11 @@ bool DBDriver::set_option_impl(Option* o) { std::ostringstream os; +#if __cplusplus >= 201103L + std::unique_ptr<Option> cleanup(o); +#else std::auto_ptr<Option> cleanup(o); +#endif switch (o->set(this)) { case Option::err_NONE: diff --git a/mysql++-3.2.3/lib/refcounted.h b/mysql++-3.2.3/lib/refcounted.h index 0869682..d985e1d 100644 --- a/mysql++-3.2.3/lib/refcounted.h +++ b/mysql++-3.2.3/lib/refcounted.h @@ -101,7 +101,11 @@ public: counted_(c), refs_(0) { +#if __cplusplus >= 201103L + std::unique_ptr<T> exception_guard(counted_); +#else std::auto_ptr<T> exception_guard(counted_); +#endif if (counted_) { refs_ = new size_t(1); } tangent added on 2018-07-12 20:05:50: Fixed by [08496d4b48e24]. |