tag/Tag: use [[gnu::pure]]

This commit is contained in:
Max Kellermann 2021-10-13 10:30:43 +02:00
parent ffde7223b9
commit 3ef7d8fecb

View File

@ -23,7 +23,6 @@
#include "Type.h" // IWYU pragma: export #include "Type.h" // IWYU pragma: export
#include "Item.hxx" // IWYU pragma: export #include "Item.hxx" // IWYU pragma: export
#include "Chrono.hxx" #include "Chrono.hxx"
#include "util/Compiler.h"
#include "util/DereferenceIterator.hxx" #include "util/DereferenceIterator.hxx"
#include <memory> #include <memory>
@ -145,14 +144,14 @@ struct Tag {
* Returns the first value of the specified tag type, or * Returns the first value of the specified tag type, or
* nullptr if none is present in this tag object. * nullptr if none is present in this tag object.
*/ */
gcc_pure [[gnu::pure]]
const char *GetValue(TagType type) const noexcept; const char *GetValue(TagType type) const noexcept;
/** /**
* Checks whether the tag contains one or more items with * Checks whether the tag contains one or more items with
* the specified type. * the specified type.
*/ */
gcc_pure [[gnu::pure]]
bool HasType(TagType type) const noexcept; bool HasType(TagType type) const noexcept;
/** /**
@ -161,7 +160,7 @@ struct Tag {
* (e.g. #TAG_ALBUM_ARTIST falls back to #TAG_ARTIST). If * (e.g. #TAG_ALBUM_ARTIST falls back to #TAG_ARTIST). If
* there is no such value, returns an empty string. * there is no such value, returns an empty string.
*/ */
gcc_pure gcc_returns_nonnull [[gnu::pure]] [[gnu::returns_nonnull]]
const char *GetSortValue(TagType type) const noexcept; const char *GetSortValue(TagType type) const noexcept;
using const_iterator = DereferenceIterator<TagItem *const*, using const_iterator = DereferenceIterator<TagItem *const*,