more [[gnu::...]] attributes
This commit is contained in:
src
IdleFlags.hxxInstance.hxxMapper.hxxMixRampInfo.hxxMusicBuffer.hxxMusicChunk.hxxMusicPipe.hxxReplayGainInfo.hxxReplayGainMode.cxxReplayGainMode.hxxSingleMode.cxxSingleMode.hxxSongLoader.hxxStateFile.hxxls.hxx
client
command
config
db
DatabaseLock.hxxInterface.hxxLightDirectory.hxxPlaylistInfo.hxxPlaylistVector.hxxRegistry.hxxSelection.hxx
plugins
update
decoder
filter
fs
input
AsyncInputStream.hxxError.hxxIcyInputStream.hxxInputPlugin.hxxInputStream.hxxRegistry.hxx
cache
plugins
java
lib
alsa
cdio
crypto
curl
dbus
expat
ffmpeg
gcrypt
icu
nfs
pcre
upnp
xiph
mixer
neighbor
net
output
pcm
player
playlist
song
storage
system
tag
thread
unix
util
@ -25,8 +25,6 @@
|
||||
#ifndef MPD_IDLE_FLAGS_HXX
|
||||
#define MPD_IDLE_FLAGS_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
/** song database has been updated*/
|
||||
static constexpr unsigned IDLE_DATABASE = 0x1;
|
||||
|
||||
@ -73,7 +71,7 @@ static constexpr unsigned IDLE_PARTITION = 0x2000;
|
||||
/**
|
||||
* Get idle names
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
const char*const*
|
||||
idle_get_names() noexcept;
|
||||
|
||||
@ -81,7 +79,7 @@ idle_get_names() noexcept;
|
||||
* Parse an idle name and return its mask. Returns 0 if the given
|
||||
* name is unknown.
|
||||
*/
|
||||
gcc_nonnull_all gcc_pure
|
||||
[[gnu::nonnull]] [[gnu::pure]]
|
||||
unsigned
|
||||
idle_parse_name(const char *name) noexcept;
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "event/Loop.hxx"
|
||||
#include "event/Thread.hxx"
|
||||
#include "event/MaskMonitor.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#ifdef ENABLE_SYSTEMD_DAEMON
|
||||
#include "lib/systemd/Watchdog.hxx"
|
||||
@ -168,7 +167,7 @@ struct Instance final
|
||||
* Find a #Partition with the given name. Returns nullptr if
|
||||
* no such partition was found.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
Partition *FindPartition(const char *name) noexcept;
|
||||
|
||||
void DeletePartition(Partition &partition) noexcept;
|
||||
|
@ -24,7 +24,6 @@
|
||||
#ifndef MPD_MAPPER_HXX
|
||||
#define MPD_MAPPER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <string>
|
||||
@ -44,7 +43,7 @@ mapper_init(AllocatedPath &&playlist_dir);
|
||||
* is basically done by converting the URI to the file system charset
|
||||
* and prepending the music directory.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
AllocatedPath
|
||||
map_uri_fs(const char *uri) noexcept;
|
||||
|
||||
@ -56,7 +55,7 @@ map_uri_fs(const char *uri) noexcept;
|
||||
* @return the relative path in UTF-8, or an empty string if mapping
|
||||
* failed
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string
|
||||
map_fs_to_utf8(Path path_fs) noexcept;
|
||||
|
||||
@ -65,7 +64,7 @@ map_fs_to_utf8(Path path_fs) noexcept;
|
||||
/**
|
||||
* Returns the playlist directory.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
const AllocatedPath &
|
||||
map_spl_path() noexcept;
|
||||
|
||||
@ -75,7 +74,7 @@ map_spl_path() noexcept;
|
||||
*
|
||||
* @return the path in file system encoding, or nullptr if mapping failed
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
AllocatedPath
|
||||
map_spl_utf8_to_fs(const char *name) noexcept;
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_MIX_RAMP_INFO_HXX
|
||||
#define MPD_MIX_RAMP_INFO_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class MixRampInfo {
|
||||
@ -35,17 +33,17 @@ public:
|
||||
end.clear();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsDefined() const noexcept {
|
||||
return !start.empty() || !end.empty();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetStart() const noexcept {
|
||||
return start.empty() ? nullptr : start.c_str();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetEnd() const noexcept {
|
||||
return end.empty() ? nullptr : end.c_str();
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
* is the same value which was passed to the constructor
|
||||
* music_buffer_new().
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned GetSize() const noexcept {
|
||||
return buffer.GetCapacity();
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ struct MusicChunkInfo {
|
||||
* Checks if the audio format if the chunk is equal to the
|
||||
* specified audio_format.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool CheckFormat(AudioFormat audio_format) const noexcept;
|
||||
#endif
|
||||
};
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "MusicChunkPtr.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#ifndef NDEBUG
|
||||
#include "pcm/AudioFormat.hxx"
|
||||
@ -59,7 +58,7 @@ public:
|
||||
* Checks if the audio format if the chunk is equal to the specified
|
||||
* audio_format.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool CheckFormat(AudioFormat other) const noexcept {
|
||||
return !audio_format.IsDefined() ||
|
||||
audio_format == other;
|
||||
@ -68,7 +67,7 @@ public:
|
||||
/**
|
||||
* Checks if the specified chunk is enqueued in the music pipe.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Contains(const MusicChunk *chunk) const noexcept;
|
||||
#endif
|
||||
|
||||
@ -76,7 +75,7 @@ public:
|
||||
* Returns the first #MusicChunk from the pipe. Returns
|
||||
* nullptr if the pipe is empty.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const MusicChunk *Peek() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
return head.get();
|
||||
@ -100,13 +99,13 @@ public:
|
||||
/**
|
||||
* Returns the number of chunks currently in this pipe.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned GetSize() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
return size;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEmpty() const noexcept {
|
||||
return GetSize() == 0;
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_REPLAY_GAIN_INFO_HXX
|
||||
#define MPD_REPLAY_GAIN_INFO_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "ReplayGainMode.hxx"
|
||||
|
||||
struct ReplayGainConfig;
|
||||
@ -42,7 +41,7 @@ struct ReplayGainTuple {
|
||||
return {-200.0f, 0.0f};
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
float CalculateScale(const ReplayGainConfig &config) const noexcept;
|
||||
};
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "ReplayGainMode.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_REPLAY_GAIN_MODE_HXX
|
||||
#define MPD_REPLAY_GAIN_MODE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class ReplayGainMode : uint8_t {
|
||||
@ -34,7 +32,7 @@ enum class ReplayGainMode : uint8_t {
|
||||
/**
|
||||
* Return the string representation of a #ReplayGainMode.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *
|
||||
ToString(ReplayGainMode mode) noexcept;
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "SingleMode.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_SINGLE_MODE_HXX
|
||||
#define MPD_SINGLE_MODE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum class SingleMode : uint8_t {
|
||||
@ -33,7 +31,7 @@ enum class SingleMode : uint8_t {
|
||||
/**
|
||||
* Return the string representation of a #SingleMode.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *
|
||||
SingleToString(SingleMode mode) noexcept;
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_SONG_LOADER_HXX
|
||||
#define MPD_SONG_LOADER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <cstddef>
|
||||
@ -72,14 +71,14 @@ public:
|
||||
/**
|
||||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
DetachedSong LoadSong(const char *uri_utf8) const;
|
||||
|
||||
private:
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
DetachedSong LoadFromDatabase(const char *uri) const;
|
||||
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
DetachedSong LoadFile(const char *path_utf8, Path path_fs) const;
|
||||
};
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "StateFileConfig.hxx"
|
||||
#include "event/FarTimerEvent.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <string>
|
||||
@ -76,7 +75,7 @@ private:
|
||||
* Check if MPD's state was modified since the last
|
||||
* RememberVersions() call.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsModified() const noexcept;
|
||||
|
||||
/* callback for #timer_event */
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "tag/Mask.hxx"
|
||||
#include "event/FullyBufferedSocket.hxx"
|
||||
#include "event/CoarseTimerEvent.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <boost/intrusive/link_mode.hpp>
|
||||
#include <boost/intrusive/list_hook.hpp>
|
||||
@ -138,7 +137,7 @@ public:
|
||||
using FullyBufferedSocket::GetEventLoop;
|
||||
using FullyBufferedSocket::GetOutputMaxSize;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsExpired() const noexcept {
|
||||
return !FullyBufferedSocket::IsDefined();
|
||||
}
|
||||
@ -211,7 +210,7 @@ public:
|
||||
FULL,
|
||||
};
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsSubscribed(const char *channel_name) const noexcept {
|
||||
return subscriptions.find(channel_name) != subscriptions.end();
|
||||
}
|
||||
@ -252,19 +251,19 @@ public:
|
||||
|
||||
void SetPartition(Partition &new_partition) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
Instance &GetInstance() const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
playlist &GetPlaylist() const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
PlayerControl &GetPlayerControl() const noexcept;
|
||||
|
||||
/**
|
||||
* Wrapper for Instance::GetDatabase().
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const Database *GetDatabase() const noexcept;
|
||||
|
||||
/**
|
||||
@ -272,7 +271,7 @@ public:
|
||||
*/
|
||||
const Database &GetDatabaseOrThrow() const;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const Storage *GetStorage() const noexcept;
|
||||
|
||||
private:
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_CLIENT_MESSAGE_HXX
|
||||
#define MPD_CLIENT_MESSAGE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -51,7 +49,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
client_message_valid_channel_name(const char *name) noexcept;
|
||||
|
||||
|
@ -21,14 +21,13 @@
|
||||
#define MPD_NEIGHBOR_COMMANDS_HXX
|
||||
|
||||
#include "CommandResult.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
struct Instance;
|
||||
class Client;
|
||||
class Request;
|
||||
class Response;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
neighbor_commands_available(const Instance &instance) noexcept;
|
||||
|
||||
|
@ -21,13 +21,12 @@
|
||||
#define MPD_PLAYLIST_COMMANDS_HXX
|
||||
|
||||
#include "CommandResult.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
class Client;
|
||||
class Request;
|
||||
class Response;
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
bool
|
||||
playlist_commands_available() noexcept;
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_CONFIG_BLOCK_HXX
|
||||
#define MPD_CONFIG_BLOCK_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -39,7 +37,7 @@ struct BlockParam {
|
||||
mutable bool used = false;
|
||||
|
||||
template<typename N, typename V>
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
BlockParam(N &&_name, V &&_value, int _line=-1) noexcept
|
||||
:name(std::forward<N>(_name)), value(std::forward<V>(_value)),
|
||||
line(_line) {}
|
||||
@ -99,7 +97,7 @@ struct ConfigBlock {
|
||||
return line < 0;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEmpty() const noexcept {
|
||||
return block_params.empty();
|
||||
}
|
||||
@ -109,17 +107,17 @@ struct ConfigBlock {
|
||||
}
|
||||
|
||||
template<typename N, typename V>
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
void AddBlockParam(N &&_name, V &&_value, int _line=-1) noexcept {
|
||||
block_params.emplace_back(std::forward<N>(_name),
|
||||
std::forward<V>(_value),
|
||||
_line);
|
||||
}
|
||||
|
||||
gcc_nonnull_all gcc_pure
|
||||
[[gnu::nonnull]] [[gnu::pure]]
|
||||
const BlockParam *GetBlockParam(const char *_name) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetBlockValue(const char *name,
|
||||
const char *default_value=nullptr) const noexcept;
|
||||
|
||||
|
@ -46,7 +46,7 @@ struct ConfigData {
|
||||
|
||||
void AddParam(ConfigOption option, ConfigParam &¶m) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const ConfigParam *GetParam(ConfigOption option) const noexcept {
|
||||
const auto &list = GetParamList(option);
|
||||
return list.empty() ? nullptr : &list.front();
|
||||
@ -60,7 +60,7 @@ struct ConfigData {
|
||||
: f(nullptr);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetString(ConfigOption option,
|
||||
const char *default_value=nullptr) const noexcept;
|
||||
|
||||
@ -100,7 +100,7 @@ struct ConfigData {
|
||||
ConfigBlock &AddBlock(ConfigBlockOption option,
|
||||
ConfigBlock &&block) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const ConfigBlock *GetBlock(ConfigBlockOption option) const noexcept {
|
||||
const auto &list = GetBlockList(option);
|
||||
return list.empty() ? nullptr : &list.front();
|
||||
@ -115,7 +115,7 @@ struct ConfigData {
|
||||
* @param key the attribute name
|
||||
* @param value the expected attribute value
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const ConfigBlock *FindBlock(ConfigBlockOption option,
|
||||
const char *key, const char *value) const;
|
||||
|
||||
|
@ -102,14 +102,14 @@ enum class ConfigBlockOption {
|
||||
/**
|
||||
* @return #ConfigOption::MAX if not found
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
enum ConfigOption
|
||||
ParseConfigOptionName(const char *name) noexcept;
|
||||
|
||||
/**
|
||||
* @return #ConfigOption::MAX if not found
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
enum ConfigBlockOption
|
||||
ParseConfigBlockOptionName(const char *name) noexcept;
|
||||
|
||||
|
@ -35,7 +35,7 @@ struct ConfigParam {
|
||||
:line(_line) {}
|
||||
|
||||
template<typename V>
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
explicit ConfigParam(V &&_value, int _line=-1) noexcept
|
||||
:value(std::forward<V>(_value)), line(_line) {}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -132,7 +132,7 @@ public:
|
||||
*
|
||||
* Caller must lock the #DecoderControl object.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool CheckCancelRead() const noexcept;
|
||||
|
||||
/**
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "Command.hxx"
|
||||
#include "Chrono.hxx"
|
||||
#include "input/Ptr.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@ -57,7 +56,7 @@ public:
|
||||
* @return the current command, or DecoderCommand::NONE if there is no
|
||||
* command pending
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
virtual DecoderCommand GetCommand() noexcept = 0;
|
||||
|
||||
/**
|
||||
@ -72,7 +71,7 @@ public:
|
||||
*
|
||||
* @return the destination position for the seek
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
virtual SongTime GetSeekTime() noexcept = 0;
|
||||
|
||||
/**
|
||||
@ -80,7 +79,7 @@ public:
|
||||
*
|
||||
* @return the destination position for the seek in frames
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
virtual uint64_t GetSeekFrame() noexcept = 0;
|
||||
|
||||
/**
|
||||
|
@ -229,7 +229,7 @@ public:
|
||||
state == DecoderState::ERROR;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool LockIsIdle() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
return IsIdle();
|
||||
@ -239,7 +239,7 @@ public:
|
||||
return state == DecoderState::START;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool LockIsStarting() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
return IsStarting();
|
||||
@ -251,7 +251,7 @@ public:
|
||||
return state == DecoderState::ERROR;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool LockHasFailed() const noexcept {
|
||||
const std::lock_guard<Mutex> protect(mutex);
|
||||
return HasFailed();
|
||||
@ -307,15 +307,15 @@ public:
|
||||
*
|
||||
* Caller must lock the object.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsCurrentSong(const DetachedSong &_song) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsUnseekableCurrentSong(const DetachedSong &_song) const noexcept {
|
||||
return !seekable && IsCurrentSong(_song);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsSeekableCurrentSong(const DetachedSong &_song) const noexcept {
|
||||
return seekable && IsCurrentSong(_song);
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_DECODER_BUFFER_HXX
|
||||
#define MPD_DECODER_BUFFER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "util/DynamicFifoBuffer.hxx"
|
||||
#include "util/ConstBuffer.hxx"
|
||||
|
||||
@ -74,7 +73,7 @@ public:
|
||||
/**
|
||||
* How many bytes are stored in the buffer?
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
size_t GetAvailable() const noexcept {
|
||||
return buffer.GetAvailable();
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_DECODER_LIST_HXX
|
||||
#define MPD_DECODER_LIST_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
struct ConfigData;
|
||||
@ -32,7 +30,7 @@ extern bool decoder_plugins_enabled[];
|
||||
|
||||
/* interface for using plugins */
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const struct DecoderPlugin *
|
||||
decoder_plugin_from_name(const char *name) noexcept;
|
||||
|
||||
@ -98,7 +96,7 @@ decoder_plugins_for_each_enabled(F f)
|
||||
* Is there at least once #DecoderPlugin that supports the specified
|
||||
* file name suffix?
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
decoder_plugins_supports_suffix(std::string_view suffix) noexcept;
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_DECODER_PLUGIN_HXX
|
||||
#define MPD_DECODER_PLUGIN_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <forward_list> // IWYU pragma: export
|
||||
#include <set>
|
||||
#include <string>
|
||||
@ -246,19 +244,19 @@ struct DecoderPlugin {
|
||||
return container_scan(path, tnum);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool SupportsUri(const char *uri) const noexcept;
|
||||
|
||||
/**
|
||||
* Does the plugin announce the specified file name suffix?
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
bool SupportsSuffix(std::string_view suffix) const noexcept;
|
||||
|
||||
/**
|
||||
* Does the plugin announce the specified MIME type?
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
bool SupportsMimeType(std::string_view mime_type) const noexcept;
|
||||
|
||||
bool SupportsContainerSuffix(std::string_view suffix) const noexcept {
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "util/ByteOrder.hxx"
|
||||
#include "input/Offset.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
@ -33,7 +32,7 @@ class InputStream;
|
||||
struct DsdId {
|
||||
char value[4];
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Equals(const char *s) const noexcept;
|
||||
};
|
||||
|
||||
@ -70,7 +69,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is,
|
||||
/**
|
||||
* Check if the sample frequency is a valid DSD frequency.
|
||||
**/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
bool
|
||||
dsdlib_valid_freq(uint32_t samplefreq) noexcept;
|
||||
|
||||
|
@ -26,11 +26,9 @@
|
||||
#ifndef MPD_FILTER_REGISTRY_HXX
|
||||
#define MPD_FILTER_REGISTRY_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
struct FilterPlugin;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const FilterPlugin *
|
||||
filter_plugin_by_name(const char *name) noexcept;
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_FS_ALLOCATED_PATH_HXX
|
||||
#define MPD_FS_ALLOCATED_PATH_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "Traits.hxx"
|
||||
#include "Path.hxx"
|
||||
|
||||
@ -81,7 +80,7 @@ public:
|
||||
|
||||
~AllocatedPath() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
operator Path() const noexcept {
|
||||
return Path::FromFS(c_str());
|
||||
}
|
||||
@ -89,40 +88,40 @@ public:
|
||||
/**
|
||||
* Join two path components with the path separator.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Build(string_view a, string_view b) noexcept {
|
||||
return AllocatedPath(Traits::Build(a, b));
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Build(Path a, string_view b) noexcept {
|
||||
return Build(a.c_str(), b);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Build(Path a, Path b) noexcept {
|
||||
return Build(a, b.c_str());
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Build(string_view a,
|
||||
const AllocatedPath &b) noexcept {
|
||||
return Build(a, b.value);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Build(const AllocatedPath &a,
|
||||
string_view b) noexcept {
|
||||
return Build(a.value, b);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Build(const AllocatedPath &a,
|
||||
const AllocatedPath &b) noexcept {
|
||||
return Build(a.value, b.value);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath Apply(Path base, Path path) noexcept {
|
||||
return Traits::Apply(base.c_str(), path.c_str());
|
||||
}
|
||||
@ -131,17 +130,17 @@ public:
|
||||
* Convert a C string that is already in the filesystem
|
||||
* character set to a #Path instance.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath FromFS(const_pointer fs) noexcept {
|
||||
return AllocatedPath(fs);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath FromFS(string_view fs) noexcept {
|
||||
return AllocatedPath(fs);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath FromFS(const_pointer _begin,
|
||||
const_pointer _end) noexcept {
|
||||
return AllocatedPath(_begin, _end);
|
||||
@ -151,13 +150,13 @@ public:
|
||||
* Convert a C++ string that is already in the filesystem
|
||||
* character set to a #Path instance.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath FromFS(string &&fs) noexcept {
|
||||
return AllocatedPath(std::move(fs));
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath FromUTF8(std::string &&utf8) noexcept {
|
||||
/* on Android, the filesystem charset is hard-coded to
|
||||
UTF-8 */
|
||||
@ -173,7 +172,7 @@ public:
|
||||
* Convert a UTF-8 C string to an #AllocatedPath instance.
|
||||
* Returns return a "nulled" instance on error.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedPath FromUTF8(std::string_view path_utf8) noexcept;
|
||||
|
||||
static AllocatedPath FromUTF8(const char *path_utf8) noexcept {
|
||||
@ -199,12 +198,12 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator==(const AllocatedPath &other) const noexcept {
|
||||
return value == other.value;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator!=(const AllocatedPath &other) const noexcept {
|
||||
return value != other.value;
|
||||
}
|
||||
@ -238,7 +237,7 @@ public:
|
||||
* @return the length of this string in number of "value_type"
|
||||
* elements (which may not be the number of characters).
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
size_t length() const noexcept {
|
||||
return value.length();
|
||||
}
|
||||
@ -248,7 +247,7 @@ public:
|
||||
* pointer is invalidated whenever the value of life of this
|
||||
* instance ends.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_pointer c_str() const noexcept {
|
||||
return value.c_str();
|
||||
}
|
||||
@ -257,7 +256,7 @@ public:
|
||||
* Returns a pointer to the raw value, not necessarily
|
||||
* null-terminated.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_pointer data() const noexcept {
|
||||
return value.data();
|
||||
}
|
||||
@ -267,7 +266,7 @@ public:
|
||||
* Returns empty string on error or if this instance is "nulled"
|
||||
* (#IsNull returns true).
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string ToUTF8() const noexcept {
|
||||
return ((Path)*this).ToUTF8();
|
||||
}
|
||||
@ -280,7 +279,7 @@ public:
|
||||
* Gets directory name of this path.
|
||||
* Returns a "nulled" instance on error.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
AllocatedPath GetDirectoryName() const noexcept {
|
||||
return ((Path)*this).GetDirectoryName();
|
||||
}
|
||||
@ -291,12 +290,12 @@ public:
|
||||
* empty string if the given path equals this object or
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_pointer Relative(Path other_fs) const noexcept {
|
||||
return Traits::Relative(c_str(), other_fs.c_str());
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_pointer GetSuffix() const noexcept {
|
||||
return ((Path)*this).GetSuffix();
|
||||
}
|
||||
@ -306,7 +305,7 @@ public:
|
||||
*/
|
||||
void ChopSeparators() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsAbsolute() const noexcept {
|
||||
return Traits::IsAbsolute(c_str());
|
||||
}
|
||||
|
@ -20,13 +20,12 @@
|
||||
#ifndef MPD_FS_CHARSET_HXX
|
||||
#define MPD_FS_CHARSET_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "Traits.hxx"
|
||||
|
||||
/**
|
||||
* Gets file system character set name.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
const char *
|
||||
GetFSCharset() noexcept;
|
||||
|
||||
|
@ -30,8 +30,6 @@
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CLASS_GLOB
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
/**
|
||||
@ -48,7 +46,7 @@ public:
|
||||
Glob(Glob &&other) noexcept = default;
|
||||
Glob &operator=(Glob &&other) noexcept = default;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Check(const char *name_fs) const noexcept;
|
||||
};
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_FS_PATH_HXX
|
||||
#define MPD_FS_PATH_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "Traits.hxx"
|
||||
|
||||
#include <cassert>
|
||||
@ -88,7 +87,7 @@ public:
|
||||
* @return the length of this string in number of "value_type"
|
||||
* elements (which may not be the number of characters).
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
size_t length() const noexcept {
|
||||
assert(!IsNull());
|
||||
|
||||
@ -117,7 +116,7 @@ public:
|
||||
* usually rejected by MPD because its protocol cannot
|
||||
* transfer newline characters).
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool HasNewline() const noexcept {
|
||||
return Traits::Find(c_str(), '\n') != nullptr;
|
||||
}
|
||||
@ -127,7 +126,7 @@ public:
|
||||
* Returns empty string on error or if this instance is "nulled"
|
||||
* (#IsNull returns true).
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string ToUTF8() const noexcept;
|
||||
|
||||
/**
|
||||
@ -139,7 +138,7 @@ public:
|
||||
* Determine the "base" file name.
|
||||
* The return value points inside this object.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
Path GetBase() const noexcept {
|
||||
return FromFS(Traits::GetBase(c_str()));
|
||||
}
|
||||
@ -148,7 +147,7 @@ public:
|
||||
* Gets directory name of this path.
|
||||
* Returns a "nulled" instance on error.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
AllocatedPath GetDirectoryName() const noexcept;
|
||||
|
||||
/**
|
||||
@ -157,17 +156,17 @@ public:
|
||||
* empty string if the given path equals this object or
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_pointer Relative(Path other_fs) const noexcept {
|
||||
return Traits::Relative(c_str(), other_fs.c_str());
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsAbsolute() const noexcept {
|
||||
return Traits::IsAbsolute(c_str());
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_pointer GetSuffix() const noexcept;
|
||||
};
|
||||
|
||||
|
@ -37,7 +37,7 @@ GetUserMusicDir() noexcept;
|
||||
/**
|
||||
* Obtains cache directory for the current user.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
AllocatedPath
|
||||
GetUserCacheDir() noexcept;
|
||||
|
||||
|
@ -71,7 +71,7 @@ struct PathTraitsFS {
|
||||
ch == SEPARATOR;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer FindLastSeparator(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
@ -100,7 +100,7 @@ struct PathTraitsFS {
|
||||
#endif
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const_pointer GetFilenameSuffix(const_pointer filename) noexcept {
|
||||
const_pointer dot = StringFindLast(filename, '.');
|
||||
return dot != nullptr && dot > filename && dot[1] != 0
|
||||
@ -108,13 +108,13 @@ struct PathTraitsFS {
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const_pointer GetPathSuffix(const_pointer path) noexcept {
|
||||
return GetFilenameSuffix(GetBase(path));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static constexpr bool IsDrive(const_pointer p) noexcept {
|
||||
return IsAlphaASCII(p[0]) && p[1] == ':';
|
||||
}
|
||||
@ -124,7 +124,7 @@ struct PathTraitsFS {
|
||||
}
|
||||
#endif
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static bool IsAbsolute(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
@ -138,18 +138,18 @@ struct PathTraitsFS {
|
||||
return IsSeparator(*p);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static bool IsSpecialFilename(const_pointer name) noexcept {
|
||||
return (name[0] == '.' && name[1] == 0) ||
|
||||
(name[0] == '.' && name[1] == '.' && name[2] == 0);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static size_t GetLength(const_pointer p) noexcept {
|
||||
return StringLength(p);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer Find(const_pointer p, value_type ch) noexcept {
|
||||
return StringFind(p, ch);
|
||||
}
|
||||
@ -158,7 +158,7 @@ struct PathTraitsFS {
|
||||
* Determine the "base" file name of the given native path.
|
||||
* The return value points inside the given string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer GetBase(const_pointer p) noexcept;
|
||||
|
||||
/**
|
||||
@ -166,7 +166,7 @@ struct PathTraitsFS {
|
||||
* As a special case, returns the string "." if there is no
|
||||
* separator in the given input string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static string_view GetParent(const_pointer p) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
@ -178,10 +178,10 @@ struct PathTraitsFS {
|
||||
* empty string if the given path equals this object or
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer Relative(string_view base, const_pointer other) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static string_view Relative(string_view base, string_view other) noexcept;
|
||||
|
||||
/**
|
||||
@ -190,14 +190,14 @@ struct PathTraitsFS {
|
||||
* remaining component is returned unchanged.
|
||||
* If both components are empty strings, empty string is returned.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static string Build(string_view a, string_view b) noexcept;
|
||||
|
||||
/**
|
||||
* Interpret the given path as being relative to the given
|
||||
* base, and return the concatenated path.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static string Apply(const_pointer base,
|
||||
const_pointer path) noexcept;
|
||||
};
|
||||
@ -221,7 +221,7 @@ struct PathTraitsUTF8 {
|
||||
return ch == SEPARATOR;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer FindLastSeparator(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
@ -236,7 +236,7 @@ struct PathTraitsUTF8 {
|
||||
return StringFindLast(p.data(), SEPARATOR, p.size());
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const_pointer GetFilenameSuffix(const_pointer filename) noexcept {
|
||||
const_pointer dot = StringFindLast(filename, '.');
|
||||
return dot != nullptr && dot > filename && dot[1] != 0
|
||||
@ -244,13 +244,13 @@ struct PathTraitsUTF8 {
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const_pointer GetPathSuffix(const_pointer path) noexcept {
|
||||
return GetFilenameSuffix(GetBase(path));
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static constexpr bool IsDrive(const_pointer p) noexcept {
|
||||
return IsAlphaASCII(p[0]) && p[1] == ':';
|
||||
}
|
||||
@ -260,7 +260,7 @@ struct PathTraitsUTF8 {
|
||||
}
|
||||
#endif
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static bool IsAbsolute(const_pointer p) noexcept {
|
||||
#if !CLANG_CHECK_VERSION(3,6)
|
||||
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||
@ -281,18 +281,18 @@ struct PathTraitsUTF8 {
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static bool IsAbsoluteOrHasScheme(const_pointer p) noexcept;
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static bool IsSpecialFilename(const_pointer name) noexcept {
|
||||
return (name[0] == '.' && name[1] == 0) ||
|
||||
(name[0] == '.' && name[1] == '.' && name[2] == 0);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static size_t GetLength(const_pointer p) noexcept {
|
||||
return StringLength(p);
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer Find(const_pointer p, value_type ch) noexcept {
|
||||
return StringFind(p, ch);
|
||||
}
|
||||
@ -301,7 +301,7 @@ struct PathTraitsUTF8 {
|
||||
* Determine the "base" file name of the given UTF-8 path.
|
||||
* The return value points inside the given string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer GetBase(const_pointer p) noexcept;
|
||||
|
||||
/**
|
||||
@ -309,7 +309,7 @@ struct PathTraitsUTF8 {
|
||||
* As a special case, returns the string "." if there is no
|
||||
* separator in the given input string.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static string_view GetParent(const_pointer p) noexcept;
|
||||
|
||||
[[gnu::pure]]
|
||||
@ -321,10 +321,10 @@ struct PathTraitsUTF8 {
|
||||
* empty string if the given path equals this object or
|
||||
* nullptr on mismatch.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static const_pointer Relative(string_view base, const_pointer other) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static string_view Relative(string_view base, string_view other) noexcept;
|
||||
|
||||
/**
|
||||
@ -333,7 +333,7 @@ struct PathTraitsUTF8 {
|
||||
* remaining component is returned unchanged.
|
||||
* If both components are empty strings, empty string is returned.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static string Build(string_view a, string_view b) noexcept;
|
||||
};
|
||||
|
||||
|
@ -25,7 +25,7 @@ AutoGunzipReader::AutoGunzipReader(Reader &_next) noexcept
|
||||
|
||||
AutoGunzipReader::~AutoGunzipReader() noexcept = default;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsGzip(const uint8_t data[4]) noexcept
|
||||
{
|
||||
|
@ -30,7 +30,6 @@
|
||||
#ifndef BUFFERED_READER_HXX
|
||||
#define BUFFERED_READER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "util/DynamicFifoBuffer.hxx"
|
||||
|
||||
#include <cstddef>
|
||||
@ -64,7 +63,7 @@ public:
|
||||
|
||||
bool Fill(bool need_more);
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
WritableBuffer<void> Read() const noexcept {
|
||||
return buffer.Read().ToVoid();
|
||||
}
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include "OutputStream.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "io/FileDescriptor.hxx"
|
||||
@ -133,7 +132,7 @@ public:
|
||||
return path;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
uint64_t Tell() const noexcept;
|
||||
|
||||
/* virtual methods from class OutputStream */
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include "Reader.hxx"
|
||||
#include "fs/AllocatedPath.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <fileapi.h>
|
||||
@ -94,7 +93,7 @@ public:
|
||||
|
||||
FileInfo GetFileInfo() const;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
uint64_t GetSize() const noexcept {
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER size;
|
||||
@ -106,7 +105,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
uint64_t GetPosition() const noexcept {
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER zero;
|
||||
|
@ -30,8 +30,6 @@
|
||||
#ifndef READER_HXX
|
||||
#define READER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
@ -52,7 +50,7 @@ public:
|
||||
* @return the number of bytes read into the given buffer or 0
|
||||
* on end-of-stream
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
virtual size_t Read(void *data, size_t size) = 0;
|
||||
};
|
||||
|
||||
|
@ -123,7 +123,7 @@ protected:
|
||||
/**
|
||||
* Determine how many bytes can be added to the buffer.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
size_t GetBufferSpace() const noexcept {
|
||||
return buffer.GetSpace();
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef INPUT_ERROR_HXX
|
||||
#define INPUT_ERROR_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <exception>
|
||||
|
||||
/**
|
||||
@ -29,7 +27,7 @@
|
||||
* exist? This function attempts to recognize exceptions thrown by
|
||||
* various input plugins.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
IsFileNotFound(std::exception_ptr e) noexcept;
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define MPD_ICY_INPUT_STREAM_HXX
|
||||
|
||||
#include "ProxyInputStream.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@ -63,7 +62,7 @@ public:
|
||||
IcyInputStream(const IcyInputStream &) = delete;
|
||||
IcyInputStream &operator=(const IcyInputStream &) = delete;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEnabled() const noexcept;
|
||||
|
||||
/* virtual methods from InputStream */
|
||||
|
@ -22,7 +22,6 @@
|
||||
|
||||
#include "Ptr.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <set>
|
||||
@ -83,7 +82,7 @@ struct InputPlugin {
|
||||
std::unique_ptr<RemoteTagScanner> (*scan_tags)(const char *uri,
|
||||
RemoteTagHandler &handler) = nullptr;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool SupportsUri(const char *uri) const noexcept;
|
||||
|
||||
template<typename F>
|
||||
@ -103,7 +102,7 @@ struct InputPlugin {
|
||||
}
|
||||
};
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
protocol_is_whitelisted(const char *proto) noexcept;
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "Offset.hxx"
|
||||
#include "Ptr.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <memory>
|
||||
@ -123,14 +122,12 @@ public:
|
||||
* notifications
|
||||
* @return an #InputStream object on success
|
||||
*/
|
||||
gcc_nonnull(1)
|
||||
static InputStreamPtr Open(const char *uri, Mutex &mutex);
|
||||
|
||||
/**
|
||||
* Just like Open(), but waits for the stream to become ready.
|
||||
* It is a wrapper for Open(), WaitReady() and Check().
|
||||
*/
|
||||
gcc_nonnull(1)
|
||||
static InputStreamPtr OpenReady(const char *uri, Mutex &mutex);
|
||||
|
||||
/**
|
||||
@ -184,14 +181,14 @@ public:
|
||||
return ready;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool HasMimeType() const noexcept {
|
||||
assert(ready);
|
||||
|
||||
return !mime.empty();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetMimeType() const noexcept {
|
||||
assert(ready);
|
||||
|
||||
@ -202,7 +199,7 @@ public:
|
||||
mime.clear();
|
||||
}
|
||||
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
void SetMimeType(const char *_mime) noexcept {
|
||||
assert(!ready);
|
||||
|
||||
@ -215,14 +212,14 @@ public:
|
||||
mime = std::move(_mime);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool KnownSize() const noexcept {
|
||||
assert(ready);
|
||||
|
||||
return size != UNKNOWN_SIZE;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
offset_type GetSize() const noexcept {
|
||||
assert(ready);
|
||||
assert(KnownSize());
|
||||
@ -236,14 +233,14 @@ public:
|
||||
offset += delta;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
offset_type GetOffset() const noexcept {
|
||||
assert(ready);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
offset_type GetRest() const noexcept {
|
||||
assert(ready);
|
||||
assert(KnownSize());
|
||||
@ -251,7 +248,7 @@ public:
|
||||
return size - offset;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsSeekable() const noexcept {
|
||||
assert(ready);
|
||||
|
||||
@ -261,7 +258,7 @@ public:
|
||||
/**
|
||||
* Determines whether seeking is cheap. This is true for local files.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool CheapSeeking() const noexcept;
|
||||
|
||||
/**
|
||||
@ -313,14 +310,14 @@ public:
|
||||
*
|
||||
* The caller must lock the mutex.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
virtual bool IsEOF() const noexcept = 0;
|
||||
|
||||
/**
|
||||
* Wrapper for IsEOF() which locks and unlocks the mutex; the
|
||||
* caller must not be holding it already.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool LockIsEOF() const noexcept;
|
||||
|
||||
/**
|
||||
@ -346,7 +343,7 @@ public:
|
||||
*
|
||||
* The caller must lock the mutex.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
virtual bool IsAvailable() const noexcept;
|
||||
|
||||
/**
|
||||
@ -363,7 +360,7 @@ public:
|
||||
* @param size the maximum number of bytes to read
|
||||
* @return the number of bytes read
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
virtual size_t Read(std::unique_lock<Mutex> &lock,
|
||||
void *ptr, size_t size) = 0;
|
||||
|
||||
@ -373,7 +370,7 @@ public:
|
||||
*
|
||||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
size_t LockRead(void *ptr, size_t size);
|
||||
|
||||
/**
|
||||
@ -387,7 +384,7 @@ public:
|
||||
* @param size the number of bytes to read
|
||||
* @return true if the whole data was read, false otherwise.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
void ReadFull(std::unique_lock<Mutex> &lock, void *ptr, size_t size);
|
||||
|
||||
/**
|
||||
@ -396,7 +393,7 @@ public:
|
||||
*
|
||||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
void LockReadFull(void *ptr, size_t size);
|
||||
|
||||
protected:
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_INPUT_REGISTRY_HXX
|
||||
#define MPD_INPUT_REGISTRY_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
/**
|
||||
* NULL terminated list of all input plugins which were enabled at
|
||||
* compile time.
|
||||
@ -40,7 +38,7 @@ extern bool input_plugins_enabled[];
|
||||
input_plugins_for_each(plugin) \
|
||||
if (input_plugins_enabled[input_plugin_iterator - input_plugins])
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
HasRemoteTagScanner(const char *uri) noexcept;
|
||||
|
||||
|
9
src/input/cache/Manager.hxx
vendored
9
src/input/cache/Manager.hxx
vendored
@ -21,7 +21,6 @@
|
||||
#define MPD_INPUT_CACHE_MANAGER_HXX
|
||||
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <boost/intrusive/set.hpp>
|
||||
#include <boost/intrusive/list.hpp>
|
||||
@ -43,15 +42,15 @@ class InputCacheManager {
|
||||
size_t total_size = 0;
|
||||
|
||||
struct ItemCompare {
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const InputCacheItem &a,
|
||||
const char *b) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const char *a,
|
||||
const InputCacheItem &b) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const InputCacheItem &a,
|
||||
const InputCacheItem &b) const noexcept;
|
||||
};
|
||||
@ -74,7 +73,7 @@ public:
|
||||
|
||||
void Flush() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Contains(const char *uri) noexcept;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
offset_type offset) override;
|
||||
};
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static inline bool
|
||||
input_ffmpeg_supported() noexcept
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ public:
|
||||
return format_id;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
CurlGlobal &GetCurl() noexcept;
|
||||
|
||||
void AddLoginHandler(QobuzSessionHandler &h) noexcept;
|
||||
|
@ -166,7 +166,7 @@ FinishQobuzInput() noexcept
|
||||
delete qobuz_client;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *
|
||||
ExtractQobuzTrackId(const char *uri)
|
||||
{
|
||||
|
@ -48,10 +48,10 @@ class File : public LocalObject {
|
||||
public:
|
||||
using LocalObject::LocalObject;
|
||||
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
static void Initialise(JNIEnv *env) noexcept;
|
||||
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
static jstring GetAbsolutePath(JNIEnv *env, jobject file) noexcept {
|
||||
return (jstring)env->CallObjectMethod(file,
|
||||
getAbsolutePath_method);
|
||||
@ -69,7 +69,7 @@ public:
|
||||
* Invoke File.getAbsolutePath() and release the
|
||||
* specified File reference.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static AllocatedPath ToAbsolutePath(JNIEnv *env,
|
||||
jobject file) noexcept;
|
||||
};
|
||||
|
@ -30,8 +30,6 @@
|
||||
#ifndef JAVA_GLOBAL_HXX
|
||||
#define JAVA_GLOBAL_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
namespace Java {
|
||||
@ -47,8 +45,9 @@ DetachCurrentThread() noexcept
|
||||
jvm->DetachCurrentThread();
|
||||
}
|
||||
|
||||
static inline gcc_pure
|
||||
JNIEnv *GetEnv() noexcept
|
||||
[[gnu::pure]]
|
||||
static inline JNIEnv *
|
||||
GetEnv() noexcept
|
||||
{
|
||||
JNIEnv *env;
|
||||
jvm->AttachCurrentThread(&env, nullptr);
|
||||
|
@ -43,7 +43,7 @@
|
||||
* enum. Returns SND_PCM_FORMAT_UNKNOWN if there is no according ALSA
|
||||
* PCM format.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
inline snd_pcm_format_t
|
||||
ToAlsaPcmFormat(SampleFormat sample_format) noexcept
|
||||
{
|
||||
@ -82,7 +82,7 @@ ToAlsaPcmFormat(SampleFormat sample_format) noexcept
|
||||
* Determine the byte-swapped PCM format. Returns
|
||||
* SND_PCM_FORMAT_UNKNOWN if the format cannot be byte-swapped.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
inline snd_pcm_format_t
|
||||
ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt) noexcept
|
||||
{
|
||||
@ -123,8 +123,7 @@ ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt) noexcept
|
||||
* Check if there is a "packed" version of the give PCM format.
|
||||
* Returns SND_PCM_FORMAT_UNKNOWN if not.
|
||||
*/
|
||||
gcc_const
|
||||
inline snd_pcm_format_t
|
||||
constexpr snd_pcm_format_t
|
||||
PackAlsaPcmFormat(snd_pcm_format_t fmt) noexcept
|
||||
{
|
||||
switch (fmt) {
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static uint_least32_t
|
||||
ParseAlsaVersion(const char *p) noexcept
|
||||
{
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_ALSA_VERSION_HXX
|
||||
#define MPD_ALSA_VERSION_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
static constexpr uint_least32_t
|
||||
@ -35,7 +33,7 @@ MakeAlsaVersion(uint_least32_t major, uint_least32_t minor,
|
||||
* Wrapper for snd_asoundlib_version() which translates the resulting
|
||||
* string to an integer constructed with MakeAlsaVersion().
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
uint_least32_t
|
||||
GetRuntimeAlsaVersion() noexcept;
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define CDIO_PARANOIA_HXX
|
||||
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cdio/version.h>
|
||||
#include <cdio/paranoia/paranoia.h>
|
||||
@ -88,7 +87,7 @@ public:
|
||||
return std::pair(first, last);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsAudioTrack(track_t i) const noexcept {
|
||||
return cdio_cddap_track_audiop(drv, i);
|
||||
}
|
||||
@ -101,7 +100,7 @@ public:
|
||||
return std::pair(first, last);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned GetTrackCount() const noexcept {
|
||||
return cdio_cddap_tracks(drv);
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define MD5_HXX
|
||||
|
||||
#include "util/StringBuffer.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
@ -41,11 +40,11 @@ template<typename T> struct ConstBuffer;
|
||||
void
|
||||
GlobalInitMD5() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::array<uint8_t, 16>
|
||||
MD5(ConstBuffer<void> input) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
StringBuffer<33>
|
||||
MD5Hex(ConstBuffer<void> input) noexcept;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016-2018 Max Kellermann <max.kellermann@gmail.com>
|
||||
* Copyright 2016-2021 Max Kellermann <max.kellermann@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -31,7 +31,6 @@
|
||||
#define CURL_EASY_HXX
|
||||
|
||||
#include "String.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <curl/curl.h>
|
||||
|
||||
@ -199,7 +198,7 @@ public:
|
||||
/**
|
||||
* Returns the response body's size, or -1 if that is unknown.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
int64_t GetContentLength() const noexcept {
|
||||
double value;
|
||||
return GetInfo(CURLINFO_CONTENT_LENGTH_DOWNLOAD, &value)
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "Request.hxx"
|
||||
#include "event/Loop.hxx"
|
||||
#include "event/SocketEvent.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
@ -84,7 +85,7 @@ private:
|
||||
(flags & SocketEvent::ERROR ? CURL_CSELECT_ERR : 0);
|
||||
}
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static unsigned CurlPollToFlags(int action) noexcept {
|
||||
switch (action) {
|
||||
case CURL_POLL_NONE:
|
||||
@ -172,7 +173,7 @@ CurlGlobal::Remove(CurlRequest &r) noexcept
|
||||
/**
|
||||
* Find a request by its CURL "easy" handle.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static CurlRequest *
|
||||
ToRequest(CURL *easy) noexcept
|
||||
{
|
||||
|
@ -172,7 +172,7 @@ CurlRequest::Done(CURLcode result) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsResponseBoundaryHeader(StringView s) noexcept
|
||||
{
|
||||
|
@ -30,9 +30,7 @@
|
||||
#ifndef CURL_VERSION_HXX
|
||||
#define CURL_VERSION_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
bool
|
||||
IsCurlOlderThan(unsigned version_num) noexcept;
|
||||
|
||||
|
@ -33,8 +33,6 @@
|
||||
#ifndef ODBUS_ERROR_HXX
|
||||
#define ODBUS_ERROR_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
namespace ODBus {
|
||||
@ -54,7 +52,7 @@ public:
|
||||
Error(const Error &) = delete;
|
||||
Error &operator=(const Error &) = delete;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
operator bool() const noexcept {
|
||||
return dbus_error_is_set(&error);
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_EXPAT_HXX
|
||||
#define MPD_EXPAT_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <expat.h>
|
||||
|
||||
#include <stdexcept>
|
||||
@ -80,11 +78,11 @@ public:
|
||||
|
||||
void Parse(InputStream &is);
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *GetAttribute(const XML_Char **atts,
|
||||
const char *name) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *GetAttributeCase(const XML_Char **atts,
|
||||
const char *name) noexcept;
|
||||
};
|
||||
@ -117,13 +115,13 @@ public:
|
||||
parser.CompleteParse();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *GetAttribute(const XML_Char **atts,
|
||||
const char *name) noexcept {
|
||||
return ExpatParser::GetAttribute(atts, name);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *GetAttributeCase(const XML_Char **atts,
|
||||
const char *name) noexcept {
|
||||
return ExpatParser::GetAttributeCase(atts, name);
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_FFMPEG_BUFFER_HXX
|
||||
#define MPD_FFMPEG_BUFFER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/mem.h>
|
||||
}
|
||||
@ -42,7 +40,7 @@ public:
|
||||
FfmpegBuffer(const FfmpegBuffer &) = delete;
|
||||
FfmpegBuffer &operator=(const FfmpegBuffer &) = delete;
|
||||
|
||||
gcc_malloc
|
||||
[[gnu::malloc]]
|
||||
void *Get(size_t min_size) noexcept {
|
||||
av_fast_malloc(&data, &size, min_size);
|
||||
return data;
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_FFMPEG_IO_CONTEXT_HXX
|
||||
#define MPD_FFMPEG_IO_CONTEXT_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "Error.hxx"
|
||||
|
||||
extern "C" {
|
||||
@ -65,12 +64,12 @@ public:
|
||||
return io_context;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
auto GetSize() const noexcept {
|
||||
return avio_size(io_context);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEOF() const noexcept {
|
||||
return avio_feof(io_context) != 0;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define MPD_FFMPEG_TIME_HXX
|
||||
|
||||
#include "Chrono.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
extern "C" {
|
||||
#include <libavutil/avutil.h>
|
||||
@ -41,7 +40,7 @@ static constexpr AVRational AV_TIME_BASE_Q{1, AV_TIME_BASE};
|
||||
/**
|
||||
* Convert a FFmpeg time stamp to a floating point value (in seconds).
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static inline FloatDuration
|
||||
FfmpegTimeToDouble(int64_t t, const AVRational time_base) noexcept
|
||||
{
|
||||
@ -64,7 +63,7 @@ RatioToAVRational()
|
||||
/**
|
||||
* Convert a FFmpeg time stamp to a #SongTime.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static inline SongTime
|
||||
FromFfmpegTime(int64_t t, const AVRational time_base) noexcept
|
||||
{
|
||||
@ -77,7 +76,7 @@ FromFfmpegTime(int64_t t, const AVRational time_base) noexcept
|
||||
/**
|
||||
* Convert a FFmpeg time stamp to a #SignedSongTime.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static inline SignedSongTime
|
||||
FromFfmpegTimeChecked(int64_t t, const AVRational time_base) noexcept
|
||||
{
|
||||
@ -89,7 +88,7 @@ FromFfmpegTimeChecked(int64_t t, const AVRational time_base) noexcept
|
||||
/**
|
||||
* Convert a #SongTime to a FFmpeg time stamp with the given base.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static inline int64_t
|
||||
ToFfmpegTime(SongTime t, const AVRational time_base) noexcept
|
||||
{
|
||||
@ -104,7 +103,7 @@ ToFfmpegTime(SongTime t, const AVRational time_base) noexcept
|
||||
constexpr int64_t
|
||||
FfmpegTimestampFallback(int64_t t, int64_t fallback)
|
||||
{
|
||||
return gcc_likely(t != int64_t(AV_NOPTS_VALUE))
|
||||
return t != int64_t(AV_NOPTS_VALUE)
|
||||
? t
|
||||
: fallback;
|
||||
}
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define GCRYPT_HASH_HXX
|
||||
|
||||
#include "util/ConstBuffer.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <gcrypt.h>
|
||||
|
||||
@ -40,7 +39,7 @@
|
||||
namespace Gcrypt {
|
||||
|
||||
template<int algo, size_t size>
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
auto
|
||||
Hash(ConstBuffer<void> input) noexcept
|
||||
{
|
||||
|
@ -31,7 +31,6 @@
|
||||
#define GCRYPT_MD5_HXX
|
||||
|
||||
#include "util/StringBuffer.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
@ -40,7 +39,7 @@ template<typename T> struct ConstBuffer;
|
||||
|
||||
namespace Gcrypt {
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::array<uint8_t, 16>
|
||||
MD5(ConstBuffer<void> input) noexcept;
|
||||
|
||||
|
@ -76,7 +76,7 @@ IcuCollateFinish() noexcept
|
||||
|
||||
#endif
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
int
|
||||
IcuCollate(std::string_view a, std::string_view b) noexcept
|
||||
{
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_ICU_COLLATE_HXX
|
||||
#define MPD_ICU_COLLATE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
/**
|
||||
@ -33,7 +31,7 @@ IcuCollateInit();
|
||||
void
|
||||
IcuCollateFinish() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
int
|
||||
IcuCollate(std::string_view a, std::string_view b) noexcept;
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_ICU_COMPARE_HXX
|
||||
#define MPD_ICU_COMPARE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "util/AllocatedString.hxx"
|
||||
|
||||
#include <string_view>
|
||||
@ -63,15 +62,15 @@ public:
|
||||
IcuCompare(IcuCompare &&) = default;
|
||||
IcuCompare &operator=(IcuCompare &&) = default;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
operator bool() const noexcept {
|
||||
return needle != nullptr;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator==(const char *haystack) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsIn(const char *haystack) const noexcept;
|
||||
};
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#ifndef MPD_ICU_CONVERTER_HXX
|
||||
#define MPD_ICU_CONVERTER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_ICU
|
||||
@ -84,7 +83,6 @@ public:
|
||||
*
|
||||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
AllocatedString ToUTF8(std::string_view s) const;
|
||||
|
||||
/**
|
||||
@ -92,7 +90,6 @@ public:
|
||||
*
|
||||
* Throws std::runtime_error on error.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
AllocatedString FromUTF8(std::string_view s) const;
|
||||
};
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_ICU_WIN32_HXX
|
||||
#define MPD_ICU_WIN32_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
class AllocatedString;
|
||||
@ -30,14 +28,14 @@ template<typename T> class BasicAllocatedString;
|
||||
/**
|
||||
* Throws std::system_error on error.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
AllocatedString
|
||||
WideCharToMultiByte(unsigned code_page, std::wstring_view src);
|
||||
|
||||
/**
|
||||
* Throws std::system_error on error.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
BasicAllocatedString<wchar_t>
|
||||
MultiByteToWideChar(unsigned code_page, std::string_view src);
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_NFS_BASE_HXX
|
||||
#define MPD_NFS_BASE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
/**
|
||||
* Set the "base" NFS server and export name. This will be the
|
||||
* default export that will be mounted if a file within this export is
|
||||
@ -38,7 +36,7 @@ nfs_set_base(const char *server, const char *export_name) noexcept;
|
||||
* "path" after the export_name is returned; otherwise, nullptr is
|
||||
* returned.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *
|
||||
nfs_check_base(const char *server, const char *path) noexcept;
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_NFS_CANCELLABLE_HXX
|
||||
#define MPD_NFS_CANCELLABLE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <boost/intrusive/list.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
@ -89,35 +87,35 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
iterator Find(reference p) noexcept {
|
||||
return std::find_if(list.begin(), list.end(), MatchPointer(p));
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_iterator Find(const_reference p) const noexcept {
|
||||
return std::find_if(list.begin(), list.end(), MatchPointer(p));
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
iterator Find(CT &c) noexcept {
|
||||
return list.iterator_to(c);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const_iterator Find(const CT &c) const noexcept {
|
||||
return list.iterator_to(c);
|
||||
}
|
||||
|
||||
public:
|
||||
#ifndef NDEBUG
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsEmpty() const noexcept {
|
||||
return std::all_of(list.begin(), list.end(), [](const auto &c) { return c.IsCancelled(); });
|
||||
}
|
||||
#endif
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Contains(const_reference p) const noexcept {
|
||||
return Find(p) != list.end();
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "event/SocketEvent.hxx"
|
||||
#include "event/CoarseTimerEvent.hxx"
|
||||
#include "event/DeferEvent.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
@ -139,7 +138,7 @@ class NfsConnection {
|
||||
bool mount_finished;
|
||||
|
||||
public:
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
NfsConnection(EventLoop &_loop,
|
||||
const char *_server, const char *_export_name) noexcept
|
||||
:socket_event(_loop, BIND_THIS_METHOD(OnSocketReady)),
|
||||
@ -157,12 +156,12 @@ public:
|
||||
return socket_event.GetEventLoop();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetServer() const noexcept {
|
||||
return server.c_str();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetExportName() const noexcept {
|
||||
return export_name.c_str();
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_NFS_GLUE_HXX
|
||||
#define MPD_NFS_GLUE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
class EventLoop;
|
||||
class NfsConnection;
|
||||
|
||||
@ -34,11 +32,11 @@ nfs_finish() noexcept;
|
||||
/**
|
||||
* Return the EventLoop that was passed to nfs_init().
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
EventLoop &
|
||||
nfs_get_event_loop() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
NfsConnection &
|
||||
nfs_get_connection(const char *server, const char *export_name) noexcept;
|
||||
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define MPD_NFS_MANAGER_HXX
|
||||
|
||||
#include "Connection.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "event/IdleEvent.hxx"
|
||||
|
||||
#include <boost/intrusive/set.hpp>
|
||||
@ -56,15 +55,15 @@ class NfsManager final {
|
||||
};
|
||||
|
||||
struct Compare {
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const LookupKey a,
|
||||
const ManagedConnection &b) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const ManagedConnection &a,
|
||||
const LookupKey b) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const ManagedConnection &a,
|
||||
const ManagedConnection &b) const noexcept;
|
||||
};
|
||||
@ -102,7 +101,7 @@ public:
|
||||
return idle_event.GetEventLoop();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
NfsConnection &GetConnection(const char *server,
|
||||
const char *export_name) noexcept;
|
||||
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
return re != nullptr;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool Match(StringView s) const noexcept {
|
||||
/* we don't need the data written to ovector, but PCRE can
|
||||
omit internal allocations if we pass a buffer to
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define _UPNPDIR_HXX_INCLUDED_
|
||||
|
||||
#include "Compat.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
#include <forward_list>
|
||||
@ -112,7 +111,7 @@ public:
|
||||
*/
|
||||
std::forward_list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string GetURI() const noexcept {
|
||||
return "upnp://" + m_deviceId + "/" + m_serviceType;
|
||||
}
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_FLAC_METADATA_CHAIN_HXX
|
||||
#define MPD_FLAC_METADATA_CHAIN_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <FLAC/metadata.h>
|
||||
|
||||
class InputStream;
|
||||
@ -67,12 +65,12 @@ public:
|
||||
|
||||
bool ReadOgg(InputStream &is) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
FLAC__Metadata_ChainStatus GetStatus() const noexcept {
|
||||
return ::FLAC__metadata_chain_status(chain);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetStatusString() const noexcept {
|
||||
return FLAC__Metadata_ChainStatusString[GetStatus()];
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user