Skip to content

Commit

Permalink
Fix warning: enumeration value not handled in switch
Browse files Browse the repository at this point in the history
./src/json.hpp:2821:17: warning: 6 enumeration values not explicitly
      handled in switch: 'null', 'boolean', 'number_integer'... [-Wswitch-enum]
  • Loading branch information
cmaglie committed Apr 15, 2017
1 parent 14dcd91 commit 54c9669
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 11 additions & 5 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2825,31 +2825,37 @@ class basic_json
AllocatorType<object_t> alloc;
alloc.destroy(m_value.object);
alloc.deallocate(m_value.object, 1);
break;
return;
}

case value_t::array:
{
AllocatorType<array_t> alloc;
alloc.destroy(m_value.array);
alloc.deallocate(m_value.array, 1);
break;
return;
}

case value_t::string:
{
AllocatorType<string_t> 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);
}

/// @}
Expand Down
16 changes: 11 additions & 5 deletions src/json.hpp.re2c
Original file line number Diff line number Diff line change
Expand Up @@ -2825,31 +2825,37 @@ class basic_json
AllocatorType<object_t> alloc;
alloc.destroy(m_value.object);
alloc.deallocate(m_value.object, 1);
break;
return;
}

case value_t::array:
{
AllocatorType<array_t> alloc;
alloc.destroy(m_value.array);
alloc.deallocate(m_value.array, 1);
break;
return;
}

case value_t::string:
{
AllocatorType<string_t> 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);
}

/// @}
Expand Down

0 comments on commit 54c9669

Please sign in to comment.