diff --git a/CMakeLists.txt b/CMakeLists.txt index fda8759..f70995a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,12 @@ add_library(jsonc src/json.cpp ) +if(MSVC) + target_compile_options(jsonc PRIVATE /W4 /WX) +else() + target_compile_options(jsonc PRIVATE -Wall -Wextra -Wpedantic -Werror) +endif() + set_property(TARGET jsonc PROPERTY COMPILE_WARNING_AS_ERROR ON) target_include_directories(jsonc PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include) diff --git a/include/json.h b/include/json.h index 92595ff..e4a9646 100644 --- a/include/json.h +++ b/include/json.h @@ -377,7 +377,7 @@ class Json { keys.insert(key); } - return std::move(keys); + return keys; } bool add(const Json& that) { diff --git a/include/json_beautifier.h b/include/json_beautifier.h index b968312..147e735 100644 --- a/include/json_beautifier.h +++ b/include/json_beautifier.h @@ -45,7 +45,7 @@ class JsonBeautifier: public JsonVisitor { } inline std::string beautifiedJson() const { - return std::move(_stream.str()); + return _stream.str(); } uint16_t _depth; diff --git a/include/json_minifier.h b/include/json_minifier.h index ec9eaf9..73a10cc 100644 --- a/include/json_minifier.h +++ b/include/json_minifier.h @@ -33,7 +33,7 @@ class JsonMinifier: public JsonVisitor { } inline std::string minifiedJson() const { - return std::move(_stream.str()); + return _stream.str(); } std::stringstream _stream; diff --git a/src/json.cpp b/src/json.cpp index 236df20..1e9a839 100644 --- a/src/json.cpp +++ b/src/json.cpp @@ -12,21 +12,21 @@ const Json& Json::null() { } Json Json::array() { - return std::move(Json(array_t())); + return Json(array_t()); } Json Json::object() { - return std::move(Json(object_t())); + return Json(object_t()); } std::optional Json::fromJson(const std::string& json) { __internal::JsonParser parser; - return std::move(parser.parse(json)); + return parser.parse(json); } std::string Json::toJson(const Json& json) { JsonMinifier minifier; - return std::move(minifier.minify(json)); + return minifier.minify(json); } } // namespace json