From 3004a7395195885639a14d21026f24d71d69e894 Mon Sep 17 00:00:00 2001 From: Tsz-Ho Yu Date: Sat, 18 Aug 2018 01:12:19 +0100 Subject: [PATCH] Fix -Wno-sometimes-uninitialized by initializing "result" in parse_sax The function parse_sax() returns sometimes-uninitialized warnings in some compilers. This commit fixes that. --- include/nlohmann/detail/input/binary_reader.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 19aae087..048f9364 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -64,7 +64,7 @@ class binary_reader const bool strict = true) { sax = sax_; - bool result; + bool result = false; switch (format) { diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 485cc7a8..84042f14 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -6033,7 +6033,7 @@ class binary_reader const bool strict = true) { sax = sax_; - bool result; + bool result = false; switch (format) {