From 54c966979cdf1aa180e1adc33db9686306a3d832 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Sat, 15 Apr 2017 13:26:25 +0200 Subject: [PATCH] Fix warning: enumeration value not handled in switch ./src/json.hpp:2821:17: warning: 6 enumeration values not explicitly handled in switch: 'null', 'boolean', 'number_integer'... [-Wswitch-enum] --- src/json.hpp | 16 +++++++++++----- src/json.hpp.re2c | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index d06954be3..69e18a2ab 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -2825,7 +2825,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.object); alloc.deallocate(m_value.object, 1); - break; + return; } case value_t::array: @@ -2833,7 +2833,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.array); alloc.deallocate(m_value.array, 1); - break; + return; } case value_t::string: @@ -2841,15 +2841,21 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.string); alloc.deallocate(m_value.string, 1); - break; + return; } - default: + case value_t::null: + case value_t::boolean: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::number_float: + case value_t::discarded: { // all other types need no specific destructor - break; + return; } } + assert(false); } /// @} diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index c2582290e..a067bf8e1 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -2825,7 +2825,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.object); alloc.deallocate(m_value.object, 1); - break; + return; } case value_t::array: @@ -2833,7 +2833,7 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.array); alloc.deallocate(m_value.array, 1); - break; + return; } case value_t::string: @@ -2841,15 +2841,21 @@ class basic_json AllocatorType alloc; alloc.destroy(m_value.string); alloc.deallocate(m_value.string, 1); - break; + return; } - default: + case value_t::null: + case value_t::boolean: + case value_t::number_integer: + case value_t::number_unsigned: + case value_t::number_float: + case value_t::discarded: { // all other types need no specific destructor - break; + return; } } + assert(false); } /// @}