more [[gnu::...]] attributes
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
#define MPD_DIRECTORY_HXX
|
||||
|
||||
#include "Ptr.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "db/Visitor.hxx"
|
||||
#include "db/PlaylistVector.hxx"
|
||||
#include "db/Ptr.hxx"
|
||||
@@ -113,7 +112,7 @@ public:
|
||||
/**
|
||||
* Create a new root #Directory object.
|
||||
*/
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
[[gnu::malloc]] [[gnu::returns_nonnull]]
|
||||
static Directory *NewRoot() noexcept {
|
||||
return new Directory(std::string(), nullptr);
|
||||
}
|
||||
@@ -141,7 +140,7 @@ public:
|
||||
* (e.g. #DEVICE_PLAYLIST) and whether the underlying plugin
|
||||
* is available.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsPluginAvailable() const noexcept;
|
||||
|
||||
/**
|
||||
@@ -164,10 +163,10 @@ public:
|
||||
/**
|
||||
* Caller must lock the #db_mutex.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const Directory *FindChild(std::string_view name) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
Directory *FindChild(std::string_view name) noexcept {
|
||||
const Directory *cthis = this;
|
||||
return const_cast<Directory *>(cthis->FindChild(name));
|
||||
@@ -211,20 +210,20 @@ public:
|
||||
*
|
||||
* @param uri the relative URI
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
LookupResult LookupDirectory(std::string_view uri) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
bool TargetExists(std::string_view target) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEmpty() const noexcept {
|
||||
return children.empty() &&
|
||||
songs.empty() &&
|
||||
playlists.empty();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetPath() const noexcept {
|
||||
return path.c_str();
|
||||
}
|
||||
@@ -232,13 +231,13 @@ public:
|
||||
/**
|
||||
* Returns the base name of the directory.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetName() const noexcept;
|
||||
|
||||
/**
|
||||
* Is this the root directory of the music database?
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsRoot() const noexcept {
|
||||
return parent == nullptr;
|
||||
}
|
||||
@@ -266,10 +265,10 @@ public:
|
||||
*
|
||||
* Caller must lock the #db_mutex.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const Song *FindSong(std::string_view name_utf8) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
Song *FindSong(std::string_view name_utf8) noexcept {
|
||||
const Directory *cthis = this;
|
||||
return const_cast<Song *>(cthis->FindSong(name_utf8));
|
||||
@@ -307,7 +306,7 @@ public:
|
||||
const VisitDirectory& visit_directory, const VisitSong& visit_song,
|
||||
const VisitPlaylist& visit_playlist) const;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
LightDirectory Export() const noexcept;
|
||||
};
|
||||
|
||||
|
@@ -25,7 +25,6 @@
|
||||
#include "db/Ptr.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "util/Manual.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <cassert>
|
||||
@@ -78,7 +77,7 @@ public:
|
||||
DatabaseListener &listener,
|
||||
const ConfigBlock &block);
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
Directory &GetRoot() noexcept {
|
||||
assert(root != NULL);
|
||||
|
||||
@@ -98,7 +97,7 @@ public:
|
||||
* @param db the #Database to be mounted; must be "open"; on
|
||||
* success, this object gains ownership of the given #Database
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
void Mount(const char *uri, DatabasePtr db);
|
||||
|
||||
/**
|
||||
@@ -106,10 +105,10 @@ public:
|
||||
*
|
||||
* @return false if the mounted database needs to be updated
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
bool Mount(const char *local_uri, const char *storage_uri);
|
||||
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
bool Unmount(const char *uri) noexcept;
|
||||
|
||||
/* virtual methods from class Database */
|
||||
|
@@ -24,7 +24,6 @@
|
||||
#include "Chrono.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "pcm/AudioFormat.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <boost/intrusive/list.hpp>
|
||||
@@ -108,14 +107,14 @@ struct Song {
|
||||
|
||||
Song(DetachedSong &&other, Directory &_parent) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetFilenameSuffix() const noexcept;
|
||||
|
||||
/**
|
||||
* Checks whether the decoder plugin for this song is
|
||||
* available.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsPluginAvailable() const noexcept;
|
||||
|
||||
/**
|
||||
@@ -149,10 +148,10 @@ struct Song {
|
||||
* Returns the URI of the song in UTF-8 encoding, including its
|
||||
* location within the music directory.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string GetURI() const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
ExportedSong Export() const noexcept;
|
||||
};
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
/* this destructor exists here just so it won't get inlined */
|
||||
UPnPDirContent::~UPnPDirContent() = default;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static UPnPDirObject::ItemClass
|
||||
ParseItemClass(StringView name) noexcept
|
||||
{
|
||||
@@ -45,7 +45,7 @@ ParseItemClass(StringView name) noexcept
|
||||
return UPnPDirObject::ItemClass::UNKNOWN;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static SignedSongTime
|
||||
ParseDuration(const char *duration) noexcept
|
||||
{
|
||||
@@ -73,7 +73,7 @@ ParseDuration(const char *duration) noexcept
|
||||
* elements. There is a very slight risk of collision in doing
|
||||
* this. Twonky returns directory names (titles) like 'Artist/Album'.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static std::string &&
|
||||
TitleToPathSegment(std::string &&s) noexcept
|
||||
{
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#define MPD_UPNP_DIRECTORY_HXX
|
||||
|
||||
#include "Object.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -39,7 +38,7 @@ public:
|
||||
|
||||
~UPnPDirContent();
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
UPnPDirObject *FindObject(std::string_view name) noexcept {
|
||||
for (auto &o : objects)
|
||||
if (o.name == name)
|
||||
|
@@ -21,7 +21,6 @@
|
||||
#define MPD_UPNP_OBJECT_HXX
|
||||
|
||||
#include "tag/Tag.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -89,12 +88,12 @@ public:
|
||||
tag.Clear();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsRoot() const noexcept {
|
||||
return type == Type::CONTAINER && id == "0";
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Check() const noexcept {
|
||||
return !id.empty() &&
|
||||
/* root nodes don't need a parent id and a
|
||||
|
Reference in New Issue
Block a user