From 7945c1771bbb57125b3e3343fa84bfc314e0f4d4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 14 Nov 2016 14:42:38 +0200 Subject: Fix few C++11-related warnings --- cutl/container/any.hxx | 6 +++++- cutl/details/config.hxx | 20 ++++++++++++++++++++ cutl/fs/auto-remove.cxx | 10 ++-------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/cutl/container/any.hxx b/cutl/container/any.hxx index 5dd1c25..c8d6308 100644 --- a/cutl/container/any.hxx +++ b/cutl/container/any.hxx @@ -5,7 +5,7 @@ #ifndef CUTL_CONTAINER_ANY_HXX #define CUTL_CONTAINER_ANY_HXX -#include // std::auto_ptr +#include // std::unique_ptr/auto_ptr #include // std::type_info #include @@ -144,7 +144,11 @@ namespace cutl }; private: +#ifdef LIBCUTL_CXX11 + std::unique_ptr holder_; +#else std::auto_ptr holder_; +#endif }; } } diff --git a/cutl/details/config.hxx b/cutl/details/config.hxx index 2d0ec8d..c57c50e 100644 --- a/cutl/details/config.hxx +++ b/cutl/details/config.hxx @@ -5,6 +5,26 @@ #ifndef CUTL_DETAILS_CONFIG_HXX #define CUTL_DETAILS_CONFIG_HXX +// C++11 support. +// +#ifdef _MSC_VER +# if _MSC_VER >= 1900 +# define LIBCUTL_CXX11 +# endif +#else +# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L +# ifdef __clang__ // Pretends to be a really old __GNUC__ on some platforms. +# define LIBCUTL_CXX11 +# elif defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 9) || __GNUC__ > 4 +# define LIBCUTL_CXX11 +# endif +# else +# define LIBCUTL_CXX11 +# endif +# endif +#endif + #ifdef LIBCUTL_BUILD2 # ifdef _MSC_VER # include diff --git a/cutl/fs/auto-remove.cxx b/cutl/fs/auto-remove.cxx index c790c29..f780c61 100644 --- a/cutl/fs/auto-remove.cxx +++ b/cutl/fs/auto-remove.cxx @@ -15,10 +15,7 @@ namespace cutl ~auto_remove () { if (!canceled_) - { - if (std::remove (path_.string ().c_str ()) == -1) - throw error (errno); - } + std::remove (path_.string ().c_str ()); // Ignore error. } auto_removes:: @@ -27,10 +24,7 @@ namespace cutl if (!canceled_) { for (paths::iterator i (paths_.begin ()); i != paths_.end (); ++i) - { - if (std::remove (i->string ().c_str ()) == -1) - throw error (errno); - } + std::remove (i->string ().c_str ()); // Ignore error. } } } -- cgit v1.1