File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1616#if JSON_USE_EXCEPTION
1717#include < stdexcept>
1818#define JSON_ASSERT (condition ) \
19- if (!(condition)) {throw std::logic_error ( " assert json failed" );} // @todo <= add detail about condition in exception
20- #define JSON_FAIL_MESSAGE (message ) do {std::ostringstream oss; oss << message; throw std::logic_error (oss.str ());}while (0 )
19+ {if (!(condition)) {throw std::logic_error ( " assert json failed" );}} // @todo <= add detail about condition in exception
20+ #define JSON_FAIL_MESSAGE (message ) \
21+ { \
22+ std::ostringstream oss; oss << message; \
23+ throw std::logic_error (oss.str ()); \
24+ }
2125// #define JSON_FAIL_MESSAGE(message) throw std::logic_error(message)
2226#else // JSON_USE_EXCEPTION
23- #define JSON_ASSERT (condition ) assert (condition);
27+ #define JSON_ASSERT (condition ) assert (condition)
2428
2529// The call to assert() will show the failure message in debug builds. In
2630// release bugs we abort, for a core-dump or debugger.
Original file line number Diff line number Diff line change 1+ # vim: et ts=4 sts=4 sw=4 tw=0
12
23IF (JSONCPP_LIB_BUILD_SHARED)
34 ADD_DEFINITIONS ( -DJSON_DLL )
@@ -22,9 +23,19 @@ ENDIF(JSONCPP_LIB_BUILD_SHARED)
2223# Run unit tests in post-build
2324# (default cmake workflow hides away the test result into a file, resulting in poor dev workflow?!?)
2425IF (JSONCPP_WITH_POST_BUILD_UNITTEST)
25- ADD_CUSTOM_COMMAND ( TARGET jsoncpp_test
26- POST_BUILD
27- COMMAND $<TARGET_FILE :jsoncpp_test >)
26+ IF (JSONCPP_LIB_BUILD_SHARED)
27+ # First, copy the shared lib, for Microsoft.
28+ # Then, run the test executable.
29+ ADD_CUSTOM_COMMAND ( TARGET jsoncpp_test
30+ POST_BUILD
31+ COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE :jsoncpp_lib > $<TARGET_FILE_DIR :jsoncpp_test >
32+ COMMAND $<TARGET_FILE :jsoncpp_test >)
33+ ELSE (JSONCPP_LIB_BUILD_SHARED )
34+ # Just run the test executable.
35+ ADD_CUSTOM_COMMAND ( TARGET jsoncpp_test
36+ POST_BUILD
37+ COMMAND $<TARGET_FILE :jsoncpp_test >)
38+ ENDIF (JSONCPP_LIB_BUILD_SHARED )
2839ENDIF (JSONCPP_WITH_POST_BUILD_UNITTEST )
2940
3041SET_TARGET_PROPERTIES (jsoncpp_test PROPERTIES OUTPUT_NAME jsoncpp_test )
Original file line number Diff line number Diff line change @@ -2203,7 +2203,7 @@ JSONTEST_FIXTURE(IteratorTest, distance) {
22032203 Json::Value json;
22042204 json[" k1" ] = " a" ;
22052205 json[" k2" ] = " b" ;
2206- int dist;
2206+ int dist = 0 ;
22072207 std::string str;
22082208 for (Json::ValueIterator it = json.begin (); it != json.end (); ++it) {
22092209 dist = it - json.begin ();
You can’t perform that action at this time.
0 commit comments