From 51ca982aa1c6f8a59022d13620ebef1d0fd95aa6 Mon Sep 17 00:00:00 2001 From: Jean-Claude Monnin Date: Wed, 21 Nov 2018 13:24:06 +0100 Subject: [PATCH] Fix warning when NDEBUG is defined [-Wunused-variable] Because `isPeek()` is side effect free this should not change anything. The reason this warning is not shown in the unit tests is because the asserts are always evaluated in the unit test: #define RAPIDJSON_ASSERT(x) (!(x) ? throw AssertException(RAPIDJSON_STRINGIFY(x)) : (void)0u) --- include/rapidjson/writer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h index 49cc0fb..6f5b690 100644 --- a/include/rapidjson/writer.h +++ b/include/rapidjson/writer.h @@ -460,8 +460,7 @@ protected: PutReserve(*os_, length); GenericStringStream is(json); while (RAPIDJSON_LIKELY(is.Tell() < length)) { - const Ch c = is.Peek(); - RAPIDJSON_ASSERT(c != '\0'); + RAPIDJSON_ASSERT(is.Peek() != '\0'); if (RAPIDJSON_UNLIKELY(!(writeFlags & kWriteValidateEncodingFlag ? Transcoder::Validate(is, *os_) : Transcoder::TranscodeUnsafe(is, *os_))))