Use the [[gnu::packed]] C++ attribute.

Suggested by: Maxime Coste <mawww@kakoune.org>
This commit is contained in:
Peter Pentchev 2021-08-21 17:06:14 +03:00
parent 6e686af8b5
commit aa88f459ff

View File

@ -14,14 +14,6 @@
#include <cstring>
#include <limits>
#ifndef __packed
#if defined(__GNUC__)
#define __packed __attribute__((packed))
#else
#define __packed
#endif
#endif
namespace Kakoune
{
@ -82,7 +74,7 @@ struct ParsedRegex
};
using NodeIndex = uint16_t;
struct Node
struct [[gnu::packed]] Node
{
Op op;
bool ignore_case;
@ -90,7 +82,7 @@ struct ParsedRegex
Codepoint value;
Quantifier quantifier;
uint16_t filler = 0;
} __packed;
};
static_assert(sizeof(Node) == 16, "");
Vector<Node, MemoryDomain::Regex> nodes;