Skip to content

Commit

Permalink
Do not allow zero size array in test (#27973)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Jul 14, 2023
1 parent 39c569b commit 4423707
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lib/format/tests/TestDecoding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ using namespace chip::TLV;
using namespace chip::TLVMeta;
using namespace chip::TestData;

const Entry<ItemInfo> _empty_item[0] = {};
// size 1 to avoid compilers complaining about empty arrays
// (not allowed by ISO 9899:2011 6.7.6.2:
// If the expression is a constant expression, it shall have a value greater
// than zero.
// ). We still claim its size is 0 in empty_meta though.
const Entry<ItemInfo> _empty_item[1] = {};
const std::array<const Node<ItemInfo>, 1> empty_meta = { { { 0, _empty_item } } };

const Entry<ItemInfo> _FakeProtocolData[] = {
Expand Down

0 comments on commit 4423707

Please sign in to comment.