From f74ae543b43c76fa98c3418df05051a64c2623b4 Mon Sep 17 00:00:00 2001 From: Vincent Cogne Date: Mon, 13 Jun 2016 05:10:14 +0200 Subject: [PATCH] Fix some clang warnings (#378) * Remove extra semicolon * Fix automatic type conversion * Replace dynamic exception specifications by C++11 noexcept * Fix deprecated definition of implicit copy constructor for 'Exception' --- include/yaml-cpp/emitter.h | 4 ++-- include/yaml-cpp/exceptions.h | 6 ++++-- include/yaml-cpp/node/node.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/yaml-cpp/emitter.h b/include/yaml-cpp/emitter.h index 5bffc25..ef92cc4 100644 --- a/include/yaml-cpp/emitter.h +++ b/include/yaml-cpp/emitter.h @@ -162,12 +162,12 @@ inline Emitter& Emitter::WriteStreamable(T value) { template <> inline void Emitter::SetStreamablePrecision(std::stringstream& stream) { - stream.precision(GetFloatPrecision()); + stream.precision(static_cast(GetFloatPrecision())); } template <> inline void Emitter::SetStreamablePrecision(std::stringstream& stream) { - stream.precision(GetDoublePrecision()); + stream.precision(static_cast(GetDoublePrecision())); } // overloads of insertion diff --git a/include/yaml-cpp/exceptions.h b/include/yaml-cpp/exceptions.h index 285fc33..5d44c05 100644 --- a/include/yaml-cpp/exceptions.h +++ b/include/yaml-cpp/exceptions.h @@ -112,7 +112,9 @@ class Exception : public std::runtime_error { public: Exception(const Mark& mark_, const std::string& msg_) : std::runtime_error(build_what(mark_, msg_)), mark(mark_), msg(msg_) {} - virtual ~Exception() throw() {} + virtual ~Exception() noexcept {} + + Exception(const Exception&) = default; Mark mark; std::string msg; @@ -163,7 +165,7 @@ class TypedKeyNotFound : public KeyNotFound { public: TypedKeyNotFound(const Mark& mark_, const T& key_) : KeyNotFound(mark_, key_), key(key_) {} - virtual ~TypedKeyNotFound() throw() {} + virtual ~TypedKeyNotFound() noexcept {} T key; }; diff --git a/include/yaml-cpp/node/node.h b/include/yaml-cpp/node/node.h index 1207f6e..1ded7d2 100644 --- a/include/yaml-cpp/node/node.h +++ b/include/yaml-cpp/node/node.h @@ -58,7 +58,7 @@ class YAML_CPP_API Node { bool IsMap() const { return Type() == NodeType::Map; } // bool conversions - YAML_CPP_OPERATOR_BOOL(); + YAML_CPP_OPERATOR_BOOL() bool operator!() const { return !IsDefined(); } // access