Build fix: POD static_assert check fails on lttng_event_exclusions
A build error occurs when building using g++ 6.4.0 on PPC32:
In file included from ../../src/common/buffer-view.hpp:11:0,
from event.cpp:9:
../../src/common/macros.hpp: In instantiation of 'AllocatedType* zmalloc(size_t) [with AllocatedType = lttng_event_exclusion; size_t = unsigned int]':
event.cpp:270:77: required from here
../../src/common/macros.hpp:102:2: error: static assertion failed: type can be malloc'ed
static_assert(can_malloc<AllocatedType>::value, "type can be malloc'ed");
^~~~~~~~~~~~~
A bug affecting gcc [6.1, 7.4] causes flexible array members to generate
a destructor for compound types. In turn, this makes any type that
contains a flexible array a non-POD object which is a problem under some
use-case (e.g., being allocated using C-style memory management
facilities).
Explicitly specifying a length of zero works around this bug, see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70932
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71147
The same bug affects re2 and they have fixed it in a similar way:
https://github.com/google/re2/blob/
9049cd28d7496e05e7b7beaec89291d8bc6a31ee/re2/dfa.cc#L123
Change-Id: I730cdeb86bb39cdbfdc5165f854ab5906aeb2192
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>