From 15048e50ece21a8b22b4c00c728f7c841175f560 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 4 Jun 2023 10:07:04 -0600 Subject: [PATCH] [serialize] Add more function attributes --- src/OT/glyf/SubsetGlyph.hh | 2 +- src/hb-serialize.hh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/OT/glyf/SubsetGlyph.hh b/src/OT/glyf/SubsetGlyph.hh index ce838aecc..8099d3c12 100644 --- a/src/OT/glyf/SubsetGlyph.hh +++ b/src/OT/glyf/SubsetGlyph.hh @@ -40,7 +40,7 @@ struct SubsetGlyph pad = 0; while (pad_length > 0) { - c->embed (pad); + (void) c->embed (pad); pad_length--; } diff --git a/src/hb-serialize.hh b/src/hb-serialize.hh index ca2712a38..66996eedf 100644 --- a/src/hb-serialize.hh +++ b/src/hb-serialize.hh @@ -573,11 +573,11 @@ struct hb_serialize_context_t } template - __attribute__((malloc, returns_nonnull)) + __attribute__((returns_nonnull)) Type *start_embed (const Type *obj HB_UNUSED = nullptr) const { return reinterpret_cast (this->head); } template - __attribute__((malloc, returns_nonnull)) + __attribute__((returns_nonnull)) Type *start_embed (const Type &obj) const { return start_embed (std::addressof (obj)); } @@ -626,6 +626,7 @@ struct hb_serialize_context_t { return this->allocate_size (Type::min_size); } template + HB_NODISCARD __attribute__((malloc)) Type *embed (const Type *obj) { unsigned int size = obj->get_size (); @@ -635,6 +636,7 @@ struct hb_serialize_context_t return ret; } template + HB_NODISCARD __attribute__((malloc)) Type *embed (const Type &obj) { return embed (std::addressof (obj)); } char *embed (const char *obj, unsigned size)