From 2bc6137ada4195be3a737c3d9410eaa60ec13a10 Mon Sep 17 00:00:00 2001 From: Christopher Dunn Date: Sat, 24 Jan 2015 13:42:37 -0600 Subject: [PATCH] fix gcc warnings --- CMakeLists.txt | 4 ++-- include/json/value.h | 4 ++-- src/lib_json/json_value.cpp | 2 +- src/test_lib_json/jsontest.cpp | 2 +- src/test_lib_json/jsontest.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8558a3..96219e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,10 +85,10 @@ endif( MSVC ) if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") # using regular Clang or AppleClang - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall") elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # using GCC - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++0x") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpedantic") endif() IF(JSONCPP_WITH_WARNING_AS_ERROR) diff --git a/include/json/value.h b/include/json/value.h index b7ac2ad..b274688 100644 --- a/include/json/value.h +++ b/include/json/value.h @@ -505,10 +505,10 @@ private: #endif } value_; ValueType type_ : 8; - int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. + unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. #ifdef JSON_VALUE_USE_INTERNAL_MAP unsigned int itemIsUsed_ : 1; // used by the ValueInternalMap container. - int memberNameIsStatic_ : 1; // used by the ValueInternalMap container. + unsigned int memberNameIsStatic_ : 1; // used by the ValueInternalMap container. #endif CommentInfo* comments_; diff --git a/src/lib_json/json_value.cpp b/src/lib_json/json_value.cpp index d646055..1a1c763 100644 --- a/src/lib_json/json_value.cpp +++ b/src/lib_json/json_value.cpp @@ -340,7 +340,7 @@ Value::Value(const Value& other) case stringValue: if (other.value_.string_) { value_.string_ = duplicateStringValue(other.value_.string_); - allocated_ |= true; + allocated_ = true; } else { value_.string_ = 0; allocated_ = false; diff --git a/src/test_lib_json/jsontest.cpp b/src/test_lib_json/jsontest.cpp index ef9c543..bd9463f 100644 --- a/src/test_lib_json/jsontest.cpp +++ b/src/test_lib_json/jsontest.cpp @@ -323,7 +323,7 @@ void Runner::listTests() const { } int Runner::runCommandLine(int argc, const char* argv[]) const { - typedef std::deque TestNames; + // typedef std::deque TestNames; Runner subrunner; for (int index = 1; index < argc; ++index) { std::string opt = argv[index]; diff --git a/src/test_lib_json/jsontest.h b/src/test_lib_json/jsontest.h index 5c56a40..cf1ef6b 100644 --- a/src/test_lib_json/jsontest.h +++ b/src/test_lib_json/jsontest.h @@ -214,7 +214,7 @@ TestResult& checkStringEqual(TestResult& result, #define JSONTEST_ASSERT_PRED(expr) \ { \ JsonTest::PredicateContext _minitest_Context = { \ - result_->predicateId_, __FILE__, __LINE__, #expr \ + result_->predicateId_, __FILE__, __LINE__, #expr, nullptr, nullptr \ }; \ result_->predicateStackTail_->next_ = &_minitest_Context; \ result_->predicateId_ += 1; \