more [[gnu::...]] attributes
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
#define MPD_DB_LOCK_HXX
|
||||
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@@ -42,7 +41,7 @@ extern ThreadId db_mutex_holder;
|
||||
/**
|
||||
* Does the current thread hold the database lock?
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static inline bool
|
||||
holding_db_lock() noexcept
|
||||
{
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "Visitor.hxx"
|
||||
#include "tag/Type.h"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
@@ -136,7 +135,7 @@ public:
|
||||
* Returns the time stamp of the last database update.
|
||||
* Returns a negative value if that is not not known/available.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
virtual std::chrono::system_clock::time_point GetUpdateStamp() const noexcept = 0;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,12 +20,9 @@
|
||||
#ifndef MPD_LIGHT_DIRECTORY_HXX
|
||||
#define MPD_LIGHT_DIRECTORY_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
struct Tag;
|
||||
|
||||
/**
|
||||
@@ -53,7 +50,7 @@ struct LightDirectory {
|
||||
return *uri == 0;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetPath() const noexcept {
|
||||
return uri;
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#ifndef MPD_PLAYLIST_INFO_HXX
|
||||
#define MPD_PLAYLIST_INFO_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <chrono>
|
||||
@@ -49,7 +47,7 @@ struct PlaylistInfo {
|
||||
constexpr CompareName(std::string_view _name) noexcept
|
||||
:name(_name) {}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const PlaylistInfo &pi) const noexcept {
|
||||
return pi.name == name;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define MPD_PLAYLIST_VECTOR_HXX
|
||||
|
||||
#include "db/PlaylistInfo.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <list>
|
||||
#include <string_view>
|
||||
@@ -31,7 +30,7 @@ protected:
|
||||
/**
|
||||
* Caller must lock the #db_mutex.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
iterator find(std::string_view name) noexcept;
|
||||
|
||||
public:
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#ifndef MPD_DATABASE_REGISTRY_HXX
|
||||
#define MPD_DATABASE_REGISTRY_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
struct DatabasePlugin;
|
||||
|
||||
/**
|
||||
@@ -30,7 +28,7 @@ struct DatabasePlugin;
|
||||
*/
|
||||
extern const DatabasePlugin *const database_plugins[];
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const DatabasePlugin *
|
||||
GetDatabasePluginByName(const char *name) noexcept;
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "protocol/RangeArg.hxx"
|
||||
#include "tag/Type.h"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -60,16 +59,16 @@ struct DatabaseSelection {
|
||||
DatabaseSelection(const char *_uri, bool _recursive,
|
||||
const SongFilter *_filter=nullptr) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEmpty() const noexcept;
|
||||
|
||||
/**
|
||||
* Does this selection contain constraints other than "base"?
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool HasOtherThanBase() const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Match(const LightSong &song) const noexcept;
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#ifndef MPD_EXCLUDE_H
|
||||
#define MPD_EXCLUDE_H
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "fs/Glob.hxx"
|
||||
#include "input/Ptr.hxx"
|
||||
#include "config.h"
|
||||
@@ -50,7 +49,7 @@ public:
|
||||
ExcludeList(const ExcludeList &_parent) noexcept
|
||||
:parent(&_parent) {}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEmpty() const noexcept {
|
||||
#ifdef HAVE_CLASS_GLOB
|
||||
return ((parent == nullptr) || parent->IsEmpty()) && patterns.empty();
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#ifndef MPD_UPDATE_QUEUE_HXX
|
||||
#define MPD_UPDATE_QUEUE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <list>
|
||||
@@ -61,7 +59,6 @@ class UpdateQueue {
|
||||
std::list<UpdateQueueItem> update_queue;
|
||||
|
||||
public:
|
||||
gcc_nonnull_all
|
||||
bool Push(SimpleDatabase &db, Storage &storage,
|
||||
std::string_view path, bool discard, unsigned id) noexcept;
|
||||
|
||||
@@ -71,10 +68,8 @@ public:
|
||||
update_queue.clear();
|
||||
}
|
||||
|
||||
gcc_nonnull_all
|
||||
void Erase(SimpleDatabase &db) noexcept;
|
||||
|
||||
gcc_nonnull_all
|
||||
void Erase(Storage &storage) noexcept;
|
||||
};
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "Queue.hxx"
|
||||
#include "event/InjectEvent.hxx"
|
||||
#include "thread/Thread.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
@@ -90,7 +89,6 @@ public:
|
||||
* the whole music directory is updated
|
||||
* @return the job id
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
unsigned Enqueue(std::string_view path, bool discard);
|
||||
|
||||
/**
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#ifndef MPD_UPDATE_IO_HXX
|
||||
#define MPD_UPDATE_IO_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
struct Directory;
|
||||
@@ -43,11 +41,11 @@ GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info) noexcept;
|
||||
bool
|
||||
GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
DirectoryExists(Storage &storage, const Directory &directory) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
directory_child_is_regular(Storage &storage, const Directory &directory,
|
||||
std::string_view name_utf8) noexcept;
|
||||
@@ -55,7 +53,7 @@ directory_child_is_regular(Storage &storage, const Directory &directory,
|
||||
/**
|
||||
* Checks if the given permissions on the mapped file are given.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
directory_child_access(Storage &storage, const Directory &directory,
|
||||
std::string_view name, int mode) noexcept;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
#include "Config.hxx"
|
||||
#include "Editor.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <atomic>
|
||||
@@ -76,7 +75,7 @@ public:
|
||||
bool Walk(Directory &root, const char *path, bool discard) noexcept;
|
||||
|
||||
private:
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool SkipSymlink(const Directory *directory,
|
||||
std::string_view utf8_name) const noexcept;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user