From 12885446d8cdf05a3df5f5579cf8e496b5578ea0 Mon Sep 17 00:00:00 2001 From: aodq Date: Thu, 23 Jul 2020 13:21:38 -0400 Subject: [PATCH 1/2] fixes unused variable 'ex' for #2304 --- include/nlohmann/detail/input/json_sax.hpp | 2 ++ single_include/nlohmann/json.hpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index ae6a6cbe..d4c32913 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -263,6 +263,7 @@ class json_sax_dom_parser const Exception& ex) { errored = true; + (void)ex; if (allow_exceptions) { JSON_THROW(ex); @@ -501,6 +502,7 @@ class json_sax_dom_callback_parser const Exception& ex) { errored = true; + (void)ex; if (allow_exceptions) { JSON_THROW(ex); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 0b7d2411..67beb73a 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -5441,6 +5441,7 @@ class json_sax_dom_parser const Exception& ex) { errored = true; + (void)ex; if (allow_exceptions) { JSON_THROW(ex); @@ -5679,6 +5680,7 @@ class json_sax_dom_callback_parser const Exception& ex) { errored = true; + (void)ex; if (allow_exceptions) { JSON_THROW(ex); From 15ec0fe150255efa9d387d0562e7b97ae67c4347 Mon Sep 17 00:00:00 2001 From: aodq Date: Fri, 24 Jul 2020 16:21:30 -0400 Subject: [PATCH 2/2] change c-style cast to static_cast for #2304 --- include/nlohmann/detail/input/json_sax.hpp | 4 ++-- single_include/nlohmann/json.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/nlohmann/detail/input/json_sax.hpp b/include/nlohmann/detail/input/json_sax.hpp index d4c32913..223acd60 100644 --- a/include/nlohmann/detail/input/json_sax.hpp +++ b/include/nlohmann/detail/input/json_sax.hpp @@ -263,7 +263,7 @@ class json_sax_dom_parser const Exception& ex) { errored = true; - (void)ex; + static_cast(ex); if (allow_exceptions) { JSON_THROW(ex); @@ -502,7 +502,7 @@ class json_sax_dom_callback_parser const Exception& ex) { errored = true; - (void)ex; + static_cast(ex); if (allow_exceptions) { JSON_THROW(ex); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 67beb73a..c41df0e8 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -5441,7 +5441,7 @@ class json_sax_dom_parser const Exception& ex) { errored = true; - (void)ex; + static_cast(ex); if (allow_exceptions) { JSON_THROW(ex); @@ -5680,7 +5680,7 @@ class json_sax_dom_callback_parser const Exception& ex) { errored = true; - (void)ex; + static_cast(ex); if (allow_exceptions) { JSON_THROW(ex);