Commit 06682bd2 authored by Max Kellermann's avatar Max Kellermann

tag/Item: remove "packed" attribute, add static_assert on alignment instead

The "packed" attribute triggers a clang 4.0 warning, and it's not necessary. All we want is correct allocation of this dynamically-sized struct.
parent 7c251fe1
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_TAG_ITEM_HXX #define MPD_TAG_ITEM_HXX
#include "TagType.h" #include "TagType.h"
#include "Compiler.h"
/** /**
* One tag value. It is a mapping of #TagType to am arbitrary string * One tag value. It is a mapping of #TagType to am arbitrary string
...@@ -40,6 +39,8 @@ struct TagItem { ...@@ -40,6 +39,8 @@ struct TagItem {
TagItem() = default; TagItem() = default;
TagItem(const TagItem &other) = delete; TagItem(const TagItem &other) = delete;
TagItem &operator=(const TagItem &other) = delete; TagItem &operator=(const TagItem &other) = delete;
} gcc_packed; };
static_assert(alignof(TagItem) == 1, "Unexpected alignment");
#endif #endif
...@@ -50,7 +50,7 @@ struct TagPoolSlot { ...@@ -50,7 +50,7 @@ struct TagPoolSlot {
static TagPoolSlot *Create(TagPoolSlot *_next, TagType type, static TagPoolSlot *Create(TagPoolSlot *_next, TagType type,
const char *value, size_t length); const char *value, size_t length);
} gcc_packed; };
TagPoolSlot * TagPoolSlot *
TagPoolSlot::Create(TagPoolSlot *_next, TagType type, TagPoolSlot::Create(TagPoolSlot *_next, TagType type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment