per C++ standard 20, alignas cannot be applied to scoped enum. despite
that there is a resolution to address this, see
https://cplusplus.github.io/CWG/issues/2354.html, it's not included in
C++20. so we have to use a different way to address
> runtime error: reference binding to misaligned address 0x610000008395
> for type 'device_type_t', which requires 4 byte alignment
otherwise the code would fail to compile with Clang-15, like:
> <source>:3:13: error: 'alignas' attribute cannot be applied to an enumeration
Signed-off-by: Kefu Chai <tchaikov@gmail.com>
using magic_t = uint64_t;
-struct device_spec_t{
+struct device_spec_t {
magic_t magic = 0;
device_type_t dtype = device_type_t::NONE;
device_id_t id = DEVICE_ID_NULL;
denc(v.id, p);
DENC_FINISH(p);
}
-};
+} __attribute__ ((packed));
std::ostream& operator<<(std::ostream&, const device_spec_t&);
std::ostream& operator<<(std::ostream& out, placement_hint_t h);
-enum class alignas(4) device_type_t : uint_fast8_t {
+enum class device_type_t : uint8_t {
NONE = 0,
HDD,
SSD,