use [[gnu::...]] attributes

This commit is contained in:
Max Kellermann
2023-03-06 15:57:36 +01:00
parent 3b9aab0684
commit 42f6a0441c
101 changed files with 167 additions and 234 deletions

View File

@@ -4,8 +4,6 @@
#ifndef MPD_DB_COUNT_HXX
#define MPD_DB_COUNT_HXX
#include "util/Compiler.h"
#include <cstdint>
enum TagType : uint8_t;
@@ -13,7 +11,6 @@ struct Partition;
class Response;
class SongFilter;
gcc_nonnull(3)
void
PrintSongCount(Response &r, const Partition &partition, const char *name,
const SongFilter *filter,

View File

@@ -4,14 +4,11 @@
#ifndef MPD_DATABASE_PLAYLIST_HXX
#define MPD_DATABASE_PLAYLIST_HXX
#include "util/Compiler.h"
class Database;
class Storage;
struct DatabaseSelection;
class PlaylistFileEditor;
gcc_nonnull(3)
void
search_add_to_playlist(const Database &db, const Storage *storage,
const char *playlist_path_utf8,

View File

@@ -21,7 +21,7 @@
#include <functional>
gcc_pure
[[gnu::pure]]
static const char *
ApplyBaseFlag(const char *uri, bool base) noexcept
{

View File

@@ -12,7 +12,7 @@
#include <string.h>
struct StringLess {
gcc_pure
[[gnu::pure]]
bool operator()(const char *a, const char *b) const noexcept {
return strcmp(a, b) < 0;
}

View File

@@ -16,7 +16,6 @@
#include "song/UriSongFilter.hxx"
#include "song/BaseSongFilter.hxx"
#include "song/TagSongFilter.hxx"
#include "util/Compiler.h"
#include "config/Block.hxx"
#include "tag/Builder.hxx"
#include "tag/Tag.hxx"
@@ -265,7 +264,7 @@ ProxySong::ProxySong(const mpd_song *song)
tag_builder.Commit(tag2);
}
gcc_const
[[gnu::const]]
static enum mpd_tag_type
Convert(TagType tag_type) noexcept
{
@@ -694,7 +693,7 @@ Visit(struct mpd_connection *connection,
visit_directory, visit_song, visit_playlist);
}
gcc_pure
[[gnu::pure]]
static bool
Match(const SongFilter *filter, const LightSong &song) noexcept
{
@@ -864,7 +863,7 @@ try {
throw;
}
gcc_pure
[[gnu::pure]]
static bool
IsFilterSupported(const ISongFilter &f) noexcept
{
@@ -890,7 +889,7 @@ IsFilterSupported(const ISongFilter &f) noexcept
return false;
}
gcc_pure
[[gnu::pure]]
static bool
IsFilterFullySupported(const SongFilter &filter,
const struct mpd_connection *connection) noexcept
@@ -908,7 +907,7 @@ IsFilterFullySupported(const SongFilter &filter,
[](const auto &item) { return IsFilterSupported(*item); });
}
gcc_pure
[[gnu::pure]]
static bool
IsFilterFullySupported(const SongFilter *filter,
const struct mpd_connection *connection) noexcept
@@ -917,7 +916,7 @@ IsFilterFullySupported(const SongFilter *filter,
IsFilterFullySupported(*filter, connection);
}
gcc_pure
[[gnu::pure]]
static bool
IsSortSupported(TagType tag_type,
const struct mpd_connection *connection) noexcept
@@ -939,7 +938,7 @@ IsSortSupported(TagType tag_type,
return Convert(tag_type) != MPD_TAG_COUNT;
}
gcc_pure
[[gnu::pure]]
static DatabaseSelection
CheckSelection(DatabaseSelection selection,
struct mpd_connection *connection) noexcept

View File

@@ -193,7 +193,7 @@ Directory::FindSong(std::string_view name_utf8) const noexcept
return nullptr;
}
gcc_pure
[[gnu::pure]]
static bool
directory_cmp(const Directory &a, const Directory &b) noexcept
{

View File

@@ -25,7 +25,7 @@
#define DIRECTORY_BEGIN "begin: "
#define DIRECTORY_END "end: "
gcc_const
[[gnu::const]]
static const char *
DeviceToTypeString(unsigned device) noexcept
{
@@ -44,7 +44,7 @@ DeviceToTypeString(unsigned device) noexcept
}
}
gcc_pure
[[gnu::pure]]
static unsigned
ParseTypeString(const char *type) noexcept
{

View File

@@ -248,7 +248,7 @@ SimpleDatabase::ReturnSong([[maybe_unused]] const LightSong *song) const noexcep
}
}
gcc_const
[[gnu::const]]
static DatabaseSelection
CheckSelection(DatabaseSelection selection) noexcept
{

View File

@@ -47,7 +47,7 @@ Song::GetURI() const noexcept
/**
* Path name traversal of a #Directory.
*/
gcc_pure
[[gnu::pure]]
static const Directory *
FindTargetDirectory(const Directory &base, std::string_view path) noexcept
{
@@ -69,7 +69,7 @@ FindTargetDirectory(const Directory &base, std::string_view path) noexcept
/**
* Path name traversal of a #Song.
*/
gcc_pure
[[gnu::pure]]
static const Song *
FindTargetSong(const Directory &_directory, std::string_view target) noexcept
{

View File

@@ -60,7 +60,7 @@ compare_tag_item(const Tag &a, const Tag &b, TagType type) noexcept
}
/* Only used for sorting/searchin a songvec, not general purpose compares */
gcc_pure
[[gnu::pure]]
static bool
song_cmp(const Song &a, const Song &b) noexcept
{

View File

@@ -563,7 +563,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
}
}
gcc_const
[[gnu::const]]
static DatabaseSelection
CheckSelection(DatabaseSelection selection) noexcept
{

View File

@@ -14,7 +14,6 @@
#include "fs/FileInfo.hxx"
#include "fs/Traits.hxx"
#include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include "Log.hxx"
#include <cassert>
@@ -61,10 +60,10 @@ struct WatchDirectory {
void LoadExcludeList(Path directory_path) noexcept;
[[nodiscard]] gcc_pure
[[nodiscard]] [[gnu::pure]]
unsigned GetDepth() const noexcept;
[[nodiscard]] gcc_pure
[[nodiscard]] [[gnu::pure]]
AllocatedPath GetUriFS() const noexcept;
};
@@ -137,7 +136,7 @@ WatchDirectory::GetUriFS() const noexcept
}
/* we don't look at "." / ".." nor files with newlines in their name */
gcc_pure
[[gnu::pure]]
static bool
SkipFilename(Path name) noexcept
{
@@ -210,7 +209,7 @@ try {
LogError(std::current_exception());
}
gcc_pure
[[gnu::pure]]
unsigned
WatchDirectory::GetDepth() const noexcept
{

View File

@@ -7,7 +7,7 @@
#include "playlist/PlaylistRegistry.hxx"
#include "fs/Traits.hxx"
gcc_pure
[[gnu::pure]]
static bool
HaveArchivePluginForFilename(const char *filename) noexcept
{
@@ -21,7 +21,7 @@ HaveArchivePluginForFilename(const char *filename) noexcept
#endif
}
gcc_pure
[[gnu::pure]]
static bool
HaveContainerPluginForFilename(const char *filename) noexcept
{
@@ -31,7 +31,7 @@ HaveContainerPluginForFilename(const char *filename) noexcept
decoder_plugins_supports_suffix(suffix);
}
gcc_pure
[[gnu::pure]]
static bool
HavePlaylistPluginForFilename(const char *filename) noexcept
{

View File

@@ -215,14 +215,14 @@ try {
}
/* we don't look at files with newlines in their name */
gcc_pure
[[gnu::pure]]
static bool
skip_path(const char *name_utf8) noexcept
{
return std::strchr(name_utf8, '\n') != nullptr;
}
gcc_pure
[[gnu::pure]]
bool
UpdateWalk::SkipSymlink(const Directory *directory,
std::string_view utf8_name) const noexcept