Commit f510564d authored by Max Kellermann's avatar Max Kellermann

more [[gnu::...]] attributes

parent 1c4b484a
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#ifndef MPD_IDLE_FLAGS_HXX #ifndef MPD_IDLE_FLAGS_HXX
#define MPD_IDLE_FLAGS_HXX #define MPD_IDLE_FLAGS_HXX
#include "util/Compiler.h"
/** song database has been updated*/ /** song database has been updated*/
static constexpr unsigned IDLE_DATABASE = 0x1; static constexpr unsigned IDLE_DATABASE = 0x1;
...@@ -73,7 +71,7 @@ static constexpr unsigned IDLE_PARTITION = 0x2000; ...@@ -73,7 +71,7 @@ static constexpr unsigned IDLE_PARTITION = 0x2000;
/** /**
* Get idle names * Get idle names
*/ */
gcc_const [[gnu::const]]
const char*const* const char*const*
idle_get_names() noexcept; idle_get_names() noexcept;
...@@ -81,7 +79,7 @@ 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 * Parse an idle name and return its mask. Returns 0 if the given
* name is unknown. * name is unknown.
*/ */
gcc_nonnull_all gcc_pure [[gnu::nonnull]] [[gnu::pure]]
unsigned unsigned
idle_parse_name(const char *name) noexcept; idle_parse_name(const char *name) noexcept;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "event/Loop.hxx" #include "event/Loop.hxx"
#include "event/Thread.hxx" #include "event/Thread.hxx"
#include "event/MaskMonitor.hxx" #include "event/MaskMonitor.hxx"
#include "util/Compiler.h"
#ifdef ENABLE_SYSTEMD_DAEMON #ifdef ENABLE_SYSTEMD_DAEMON
#include "lib/systemd/Watchdog.hxx" #include "lib/systemd/Watchdog.hxx"
...@@ -168,7 +167,7 @@ struct Instance final ...@@ -168,7 +167,7 @@ struct Instance final
* Find a #Partition with the given name. Returns nullptr if * Find a #Partition with the given name. Returns nullptr if
* no such partition was found. * no such partition was found.
*/ */
gcc_pure [[gnu::pure]]
Partition *FindPartition(const char *name) noexcept; Partition *FindPartition(const char *name) noexcept;
void DeletePartition(Partition &partition) noexcept; void DeletePartition(Partition &partition) noexcept;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#ifndef MPD_MAPPER_HXX #ifndef MPD_MAPPER_HXX
#define MPD_MAPPER_HXX #define MPD_MAPPER_HXX
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#include <string> #include <string>
...@@ -44,7 +43,7 @@ mapper_init(AllocatedPath &&playlist_dir); ...@@ -44,7 +43,7 @@ mapper_init(AllocatedPath &&playlist_dir);
* is basically done by converting the URI to the file system charset * is basically done by converting the URI to the file system charset
* and prepending the music directory. * and prepending the music directory.
*/ */
gcc_pure [[gnu::pure]]
AllocatedPath AllocatedPath
map_uri_fs(const char *uri) noexcept; map_uri_fs(const char *uri) noexcept;
...@@ -56,7 +55,7 @@ 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 * @return the relative path in UTF-8, or an empty string if mapping
* failed * failed
*/ */
gcc_pure [[gnu::pure]]
std::string std::string
map_fs_to_utf8(Path path_fs) noexcept; map_fs_to_utf8(Path path_fs) noexcept;
...@@ -65,7 +64,7 @@ map_fs_to_utf8(Path path_fs) noexcept; ...@@ -65,7 +64,7 @@ map_fs_to_utf8(Path path_fs) noexcept;
/** /**
* Returns the playlist directory. * Returns the playlist directory.
*/ */
gcc_const [[gnu::const]]
const AllocatedPath & const AllocatedPath &
map_spl_path() noexcept; map_spl_path() noexcept;
...@@ -75,7 +74,7 @@ map_spl_path() noexcept; ...@@ -75,7 +74,7 @@ map_spl_path() noexcept;
* *
* @return the path in file system encoding, or nullptr if mapping failed * @return the path in file system encoding, or nullptr if mapping failed
*/ */
gcc_pure [[gnu::pure]]
AllocatedPath AllocatedPath
map_spl_utf8_to_fs(const char *name) noexcept; map_spl_utf8_to_fs(const char *name) noexcept;
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_MIX_RAMP_INFO_HXX #ifndef MPD_MIX_RAMP_INFO_HXX
#define MPD_MIX_RAMP_INFO_HXX #define MPD_MIX_RAMP_INFO_HXX
#include "util/Compiler.h"
#include <string> #include <string>
class MixRampInfo { class MixRampInfo {
...@@ -35,17 +33,17 @@ public: ...@@ -35,17 +33,17 @@ public:
end.clear(); end.clear();
} }
gcc_pure [[gnu::pure]]
bool IsDefined() const noexcept { bool IsDefined() const noexcept {
return !start.empty() || !end.empty(); return !start.empty() || !end.empty();
} }
gcc_pure [[gnu::pure]]
const char *GetStart() const noexcept { const char *GetStart() const noexcept {
return start.empty() ? nullptr : start.c_str(); return start.empty() ? nullptr : start.c_str();
} }
gcc_pure [[gnu::pure]]
const char *GetEnd() const noexcept { const char *GetEnd() const noexcept {
return end.empty() ? nullptr : end.c_str(); return end.empty() ? nullptr : end.c_str();
} }
......
...@@ -63,7 +63,7 @@ public: ...@@ -63,7 +63,7 @@ public:
* is the same value which was passed to the constructor * is the same value which was passed to the constructor
* music_buffer_new(). * music_buffer_new().
*/ */
gcc_pure [[gnu::pure]]
unsigned GetSize() const noexcept { unsigned GetSize() const noexcept {
return buffer.GetCapacity(); return buffer.GetCapacity();
} }
......
...@@ -105,7 +105,7 @@ struct MusicChunkInfo { ...@@ -105,7 +105,7 @@ struct MusicChunkInfo {
* Checks if the audio format if the chunk is equal to the * Checks if the audio format if the chunk is equal to the
* specified audio_format. * specified audio_format.
*/ */
gcc_pure [[gnu::pure]]
bool CheckFormat(AudioFormat audio_format) const noexcept; bool CheckFormat(AudioFormat audio_format) const noexcept;
#endif #endif
}; };
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "MusicChunkPtr.hxx" #include "MusicChunkPtr.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#ifndef NDEBUG #ifndef NDEBUG
#include "pcm/AudioFormat.hxx" #include "pcm/AudioFormat.hxx"
...@@ -59,7 +58,7 @@ public: ...@@ -59,7 +58,7 @@ public:
* Checks if the audio format if the chunk is equal to the specified * Checks if the audio format if the chunk is equal to the specified
* audio_format. * audio_format.
*/ */
gcc_pure [[gnu::pure]]
bool CheckFormat(AudioFormat other) const noexcept { bool CheckFormat(AudioFormat other) const noexcept {
return !audio_format.IsDefined() || return !audio_format.IsDefined() ||
audio_format == other; audio_format == other;
...@@ -68,7 +67,7 @@ public: ...@@ -68,7 +67,7 @@ public:
/** /**
* Checks if the specified chunk is enqueued in the music pipe. * Checks if the specified chunk is enqueued in the music pipe.
*/ */
gcc_pure [[gnu::pure]]
bool Contains(const MusicChunk *chunk) const noexcept; bool Contains(const MusicChunk *chunk) const noexcept;
#endif #endif
...@@ -76,7 +75,7 @@ public: ...@@ -76,7 +75,7 @@ public:
* Returns the first #MusicChunk from the pipe. Returns * Returns the first #MusicChunk from the pipe. Returns
* nullptr if the pipe is empty. * nullptr if the pipe is empty.
*/ */
gcc_pure [[gnu::pure]]
const MusicChunk *Peek() const noexcept { const MusicChunk *Peek() const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return head.get(); return head.get();
...@@ -100,13 +99,13 @@ public: ...@@ -100,13 +99,13 @@ public:
/** /**
* Returns the number of chunks currently in this pipe. * Returns the number of chunks currently in this pipe.
*/ */
gcc_pure [[gnu::pure]]
unsigned GetSize() const noexcept { unsigned GetSize() const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return size; return size;
} }
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return GetSize() == 0; return GetSize() == 0;
} }
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_REPLAY_GAIN_INFO_HXX #ifndef MPD_REPLAY_GAIN_INFO_HXX
#define MPD_REPLAY_GAIN_INFO_HXX #define MPD_REPLAY_GAIN_INFO_HXX
#include "util/Compiler.h"
#include "ReplayGainMode.hxx" #include "ReplayGainMode.hxx"
struct ReplayGainConfig; struct ReplayGainConfig;
...@@ -42,7 +41,7 @@ struct ReplayGainTuple { ...@@ -42,7 +41,7 @@ struct ReplayGainTuple {
return {-200.0f, 0.0f}; return {-200.0f, 0.0f};
} }
gcc_pure [[gnu::pure]]
float CalculateScale(const ReplayGainConfig &config) const noexcept; float CalculateScale(const ReplayGainConfig &config) const noexcept;
}; };
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "ReplayGainMode.hxx" #include "ReplayGainMode.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_REPLAY_GAIN_MODE_HXX #ifndef MPD_REPLAY_GAIN_MODE_HXX
#define MPD_REPLAY_GAIN_MODE_HXX #define MPD_REPLAY_GAIN_MODE_HXX
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
enum class ReplayGainMode : uint8_t { enum class ReplayGainMode : uint8_t {
...@@ -34,7 +32,7 @@ enum class ReplayGainMode : uint8_t { ...@@ -34,7 +32,7 @@ enum class ReplayGainMode : uint8_t {
/** /**
* Return the string representation of a #ReplayGainMode. * Return the string representation of a #ReplayGainMode.
*/ */
gcc_pure [[gnu::pure]]
const char * const char *
ToString(ReplayGainMode mode) noexcept; ToString(ReplayGainMode mode) noexcept;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
#include "SingleMode.hxx" #include "SingleMode.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_SINGLE_MODE_HXX #ifndef MPD_SINGLE_MODE_HXX
#define MPD_SINGLE_MODE_HXX #define MPD_SINGLE_MODE_HXX
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
enum class SingleMode : uint8_t { enum class SingleMode : uint8_t {
...@@ -33,7 +31,7 @@ enum class SingleMode : uint8_t { ...@@ -33,7 +31,7 @@ enum class SingleMode : uint8_t {
/** /**
* Return the string representation of a #SingleMode. * Return the string representation of a #SingleMode.
*/ */
gcc_pure [[gnu::pure]]
const char * const char *
SingleToString(SingleMode mode) noexcept; SingleToString(SingleMode mode) noexcept;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_SONG_LOADER_HXX #ifndef MPD_SONG_LOADER_HXX
#define MPD_SONG_LOADER_HXX #define MPD_SONG_LOADER_HXX
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#include <cstddef> #include <cstddef>
...@@ -72,14 +71,14 @@ public: ...@@ -72,14 +71,14 @@ public:
/** /**
* Throws #std::runtime_error on error. * Throws #std::runtime_error on error.
*/ */
gcc_nonnull_all [[gnu::nonnull]]
DetachedSong LoadSong(const char *uri_utf8) const; DetachedSong LoadSong(const char *uri_utf8) const;
private: private:
gcc_nonnull_all [[gnu::nonnull]]
DetachedSong LoadFromDatabase(const char *uri) const; DetachedSong LoadFromDatabase(const char *uri) const;
gcc_nonnull_all [[gnu::nonnull]]
DetachedSong LoadFile(const char *path_utf8, Path path_fs) const; DetachedSong LoadFile(const char *path_utf8, Path path_fs) const;
}; };
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "StateFileConfig.hxx" #include "StateFileConfig.hxx"
#include "event/FarTimerEvent.hxx" #include "event/FarTimerEvent.hxx"
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#include <string> #include <string>
...@@ -76,7 +75,7 @@ private: ...@@ -76,7 +75,7 @@ private:
* Check if MPD's state was modified since the last * Check if MPD's state was modified since the last
* RememberVersions() call. * RememberVersions() call.
*/ */
gcc_pure [[gnu::pure]]
bool IsModified() const noexcept; bool IsModified() const noexcept;
/* callback for #timer_event */ /* callback for #timer_event */
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#include "tag/Mask.hxx" #include "tag/Mask.hxx"
#include "event/FullyBufferedSocket.hxx" #include "event/FullyBufferedSocket.hxx"
#include "event/CoarseTimerEvent.hxx" #include "event/CoarseTimerEvent.hxx"
#include "util/Compiler.h"
#include <boost/intrusive/link_mode.hpp> #include <boost/intrusive/link_mode.hpp>
#include <boost/intrusive/list_hook.hpp> #include <boost/intrusive/list_hook.hpp>
...@@ -138,7 +137,7 @@ public: ...@@ -138,7 +137,7 @@ public:
using FullyBufferedSocket::GetEventLoop; using FullyBufferedSocket::GetEventLoop;
using FullyBufferedSocket::GetOutputMaxSize; using FullyBufferedSocket::GetOutputMaxSize;
gcc_pure [[gnu::pure]]
bool IsExpired() const noexcept { bool IsExpired() const noexcept {
return !FullyBufferedSocket::IsDefined(); return !FullyBufferedSocket::IsDefined();
} }
...@@ -211,7 +210,7 @@ public: ...@@ -211,7 +210,7 @@ public:
FULL, FULL,
}; };
gcc_pure [[gnu::pure]]
bool IsSubscribed(const char *channel_name) const noexcept { bool IsSubscribed(const char *channel_name) const noexcept {
return subscriptions.find(channel_name) != subscriptions.end(); return subscriptions.find(channel_name) != subscriptions.end();
} }
...@@ -252,19 +251,19 @@ public: ...@@ -252,19 +251,19 @@ public:
void SetPartition(Partition &new_partition) noexcept; void SetPartition(Partition &new_partition) noexcept;
gcc_pure [[gnu::pure]]
Instance &GetInstance() const noexcept; Instance &GetInstance() const noexcept;
gcc_pure [[gnu::pure]]
playlist &GetPlaylist() const noexcept; playlist &GetPlaylist() const noexcept;
gcc_pure [[gnu::pure]]
PlayerControl &GetPlayerControl() const noexcept; PlayerControl &GetPlayerControl() const noexcept;
/** /**
* Wrapper for Instance::GetDatabase(). * Wrapper for Instance::GetDatabase().
*/ */
gcc_pure [[gnu::pure]]
const Database *GetDatabase() const noexcept; const Database *GetDatabase() const noexcept;
/** /**
...@@ -272,7 +271,7 @@ public: ...@@ -272,7 +271,7 @@ public:
*/ */
const Database &GetDatabaseOrThrow() const; const Database &GetDatabaseOrThrow() const;
gcc_pure [[gnu::pure]]
const Storage *GetStorage() const noexcept; const Storage *GetStorage() const noexcept;
private: private:
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_CLIENT_MESSAGE_HXX #ifndef MPD_CLIENT_MESSAGE_HXX
#define MPD_CLIENT_MESSAGE_HXX #define MPD_CLIENT_MESSAGE_HXX
#include "util/Compiler.h"
#include <string> #include <string>
#ifdef _WIN32 #ifdef _WIN32
...@@ -51,7 +49,7 @@ public: ...@@ -51,7 +49,7 @@ public:
} }
}; };
gcc_pure [[gnu::pure]]
bool bool
client_message_valid_channel_name(const char *name) noexcept; client_message_valid_channel_name(const char *name) noexcept;
......
...@@ -21,14 +21,13 @@ ...@@ -21,14 +21,13 @@
#define MPD_NEIGHBOR_COMMANDS_HXX #define MPD_NEIGHBOR_COMMANDS_HXX
#include "CommandResult.hxx" #include "CommandResult.hxx"
#include "util/Compiler.h"
struct Instance; struct Instance;
class Client; class Client;
class Request; class Request;
class Response; class Response;
gcc_pure [[gnu::pure]]
bool bool
neighbor_commands_available(const Instance &instance) noexcept; neighbor_commands_available(const Instance &instance) noexcept;
......
...@@ -21,13 +21,12 @@ ...@@ -21,13 +21,12 @@
#define MPD_PLAYLIST_COMMANDS_HXX #define MPD_PLAYLIST_COMMANDS_HXX
#include "CommandResult.hxx" #include "CommandResult.hxx"
#include "util/Compiler.h"
class Client; class Client;
class Request; class Request;
class Response; class Response;
gcc_const [[gnu::const]]
bool bool
playlist_commands_available() noexcept; playlist_commands_available() noexcept;
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_CONFIG_BLOCK_HXX #ifndef MPD_CONFIG_BLOCK_HXX
#define MPD_CONFIG_BLOCK_HXX #define MPD_CONFIG_BLOCK_HXX
#include "util/Compiler.h"
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -39,7 +37,7 @@ struct BlockParam { ...@@ -39,7 +37,7 @@ struct BlockParam {
mutable bool used = false; mutable bool used = false;
template<typename N, typename V> template<typename N, typename V>
gcc_nonnull_all [[gnu::nonnull]]
BlockParam(N &&_name, V &&_value, int _line=-1) noexcept BlockParam(N &&_name, V &&_value, int _line=-1) noexcept
:name(std::forward<N>(_name)), value(std::forward<V>(_value)), :name(std::forward<N>(_name)), value(std::forward<V>(_value)),
line(_line) {} line(_line) {}
...@@ -99,7 +97,7 @@ struct ConfigBlock { ...@@ -99,7 +97,7 @@ struct ConfigBlock {
return line < 0; return line < 0;
} }
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return block_params.empty(); return block_params.empty();
} }
...@@ -109,17 +107,17 @@ struct ConfigBlock { ...@@ -109,17 +107,17 @@ struct ConfigBlock {
} }
template<typename N, typename V> template<typename N, typename V>
gcc_nonnull_all [[gnu::nonnull]]
void AddBlockParam(N &&_name, V &&_value, int _line=-1) noexcept { void AddBlockParam(N &&_name, V &&_value, int _line=-1) noexcept {
block_params.emplace_back(std::forward<N>(_name), block_params.emplace_back(std::forward<N>(_name),
std::forward<V>(_value), std::forward<V>(_value),
_line); _line);
} }
gcc_nonnull_all gcc_pure [[gnu::nonnull]] [[gnu::pure]]
const BlockParam *GetBlockParam(const char *_name) const noexcept; const BlockParam *GetBlockParam(const char *_name) const noexcept;
gcc_pure [[gnu::pure]]
const char *GetBlockValue(const char *name, const char *GetBlockValue(const char *name,
const char *default_value=nullptr) const noexcept; const char *default_value=nullptr) const noexcept;
......
...@@ -46,7 +46,7 @@ struct ConfigData { ...@@ -46,7 +46,7 @@ struct ConfigData {
void AddParam(ConfigOption option, ConfigParam &&param) noexcept; void AddParam(ConfigOption option, ConfigParam &&param) noexcept;
gcc_pure [[gnu::pure]]
const ConfigParam *GetParam(ConfigOption option) const noexcept { const ConfigParam *GetParam(ConfigOption option) const noexcept {
const auto &list = GetParamList(option); const auto &list = GetParamList(option);
return list.empty() ? nullptr : &list.front(); return list.empty() ? nullptr : &list.front();
...@@ -60,7 +60,7 @@ struct ConfigData { ...@@ -60,7 +60,7 @@ struct ConfigData {
: f(nullptr); : f(nullptr);
} }
gcc_pure [[gnu::pure]]
const char *GetString(ConfigOption option, const char *GetString(ConfigOption option,
const char *default_value=nullptr) const noexcept; const char *default_value=nullptr) const noexcept;
...@@ -100,7 +100,7 @@ struct ConfigData { ...@@ -100,7 +100,7 @@ struct ConfigData {
ConfigBlock &AddBlock(ConfigBlockOption option, ConfigBlock &AddBlock(ConfigBlockOption option,
ConfigBlock &&block) noexcept; ConfigBlock &&block) noexcept;
gcc_pure [[gnu::pure]]
const ConfigBlock *GetBlock(ConfigBlockOption option) const noexcept { const ConfigBlock *GetBlock(ConfigBlockOption option) const noexcept {
const auto &list = GetBlockList(option); const auto &list = GetBlockList(option);
return list.empty() ? nullptr : &list.front(); return list.empty() ? nullptr : &list.front();
...@@ -115,7 +115,7 @@ struct ConfigData { ...@@ -115,7 +115,7 @@ struct ConfigData {
* @param key the attribute name * @param key the attribute name
* @param value the expected attribute value * @param value the expected attribute value
*/ */
gcc_pure [[gnu::pure]]
const ConfigBlock *FindBlock(ConfigBlockOption option, const ConfigBlock *FindBlock(ConfigBlockOption option,
const char *key, const char *value) const; const char *key, const char *value) const;
......
...@@ -102,14 +102,14 @@ enum class ConfigBlockOption { ...@@ -102,14 +102,14 @@ enum class ConfigBlockOption {
/** /**
* @return #ConfigOption::MAX if not found * @return #ConfigOption::MAX if not found
*/ */
gcc_pure [[gnu::pure]]
enum ConfigOption enum ConfigOption
ParseConfigOptionName(const char *name) noexcept; ParseConfigOptionName(const char *name) noexcept;
/** /**
* @return #ConfigOption::MAX if not found * @return #ConfigOption::MAX if not found
*/ */
gcc_pure [[gnu::pure]]
enum ConfigBlockOption enum ConfigBlockOption
ParseConfigBlockOptionName(const char *name) noexcept; ParseConfigBlockOptionName(const char *name) noexcept;
......
...@@ -35,7 +35,7 @@ struct ConfigParam { ...@@ -35,7 +35,7 @@ struct ConfigParam {
:line(_line) {} :line(_line) {}
template<typename V> template<typename V>
gcc_nonnull_all [[gnu::nonnull]]
explicit ConfigParam(V &&_value, int _line=-1) noexcept explicit ConfigParam(V &&_value, int _line=-1) noexcept
:value(std::forward<V>(_value)), line(_line) {} :value(std::forward<V>(_value)), line(_line) {}
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
#define MPD_DB_LOCK_HXX #define MPD_DB_LOCK_HXX
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
...@@ -42,7 +41,7 @@ extern ThreadId db_mutex_holder; ...@@ -42,7 +41,7 @@ extern ThreadId db_mutex_holder;
/** /**
* Does the current thread hold the database lock? * Does the current thread hold the database lock?
*/ */
gcc_pure [[gnu::pure]]
static inline bool static inline bool
holding_db_lock() noexcept holding_db_lock() noexcept
{ {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "Visitor.hxx" #include "Visitor.hxx"
#include "tag/Type.h" #include "tag/Type.h"
#include "util/Compiler.h"
#include <chrono> #include <chrono>
#include <string> #include <string>
...@@ -136,7 +135,7 @@ public: ...@@ -136,7 +135,7 @@ public:
* Returns the time stamp of the last database update. * Returns the time stamp of the last database update.
* Returns a negative value if that is not not known/available. * 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; virtual std::chrono::system_clock::time_point GetUpdateStamp() const noexcept = 0;
}; };
......
...@@ -20,12 +20,9 @@ ...@@ -20,12 +20,9 @@
#ifndef MPD_LIGHT_DIRECTORY_HXX #ifndef MPD_LIGHT_DIRECTORY_HXX
#define MPD_LIGHT_DIRECTORY_HXX #define MPD_LIGHT_DIRECTORY_HXX
#include "util/Compiler.h" #include <chrono>
#include <string> #include <string>
#include <time.h>
struct Tag; struct Tag;
/** /**
...@@ -53,7 +50,7 @@ struct LightDirectory { ...@@ -53,7 +50,7 @@ struct LightDirectory {
return *uri == 0; return *uri == 0;
} }
gcc_pure [[gnu::pure]]
const char *GetPath() const noexcept { const char *GetPath() const noexcept {
return uri; return uri;
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_PLAYLIST_INFO_HXX #ifndef MPD_PLAYLIST_INFO_HXX
#define MPD_PLAYLIST_INFO_HXX #define MPD_PLAYLIST_INFO_HXX
#include "util/Compiler.h"
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <chrono> #include <chrono>
...@@ -49,7 +47,7 @@ struct PlaylistInfo { ...@@ -49,7 +47,7 @@ struct PlaylistInfo {
constexpr CompareName(std::string_view _name) noexcept constexpr CompareName(std::string_view _name) noexcept
:name(_name) {} :name(_name) {}
gcc_pure [[gnu::pure]]
bool operator()(const PlaylistInfo &pi) const noexcept { bool operator()(const PlaylistInfo &pi) const noexcept {
return pi.name == name; return pi.name == name;
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_PLAYLIST_VECTOR_HXX #define MPD_PLAYLIST_VECTOR_HXX
#include "db/PlaylistInfo.hxx" #include "db/PlaylistInfo.hxx"
#include "util/Compiler.h"
#include <list> #include <list>
#include <string_view> #include <string_view>
...@@ -31,7 +30,7 @@ protected: ...@@ -31,7 +30,7 @@ protected:
/** /**
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
gcc_pure [[gnu::pure]]
iterator find(std::string_view name) noexcept; iterator find(std::string_view name) noexcept;
public: public:
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_DATABASE_REGISTRY_HXX #ifndef MPD_DATABASE_REGISTRY_HXX
#define MPD_DATABASE_REGISTRY_HXX #define MPD_DATABASE_REGISTRY_HXX
#include "util/Compiler.h"
struct DatabasePlugin; struct DatabasePlugin;
/** /**
...@@ -30,7 +28,7 @@ struct DatabasePlugin; ...@@ -30,7 +28,7 @@ struct DatabasePlugin;
*/ */
extern const DatabasePlugin *const database_plugins[]; extern const DatabasePlugin *const database_plugins[];
gcc_pure [[gnu::pure]]
const DatabasePlugin * const DatabasePlugin *
GetDatabasePluginByName(const char *name) noexcept; GetDatabasePluginByName(const char *name) noexcept;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "protocol/RangeArg.hxx" #include "protocol/RangeArg.hxx"
#include "tag/Type.h" #include "tag/Type.h"
#include "util/Compiler.h"
#include <string> #include <string>
...@@ -60,16 +59,16 @@ struct DatabaseSelection { ...@@ -60,16 +59,16 @@ struct DatabaseSelection {
DatabaseSelection(const char *_uri, bool _recursive, DatabaseSelection(const char *_uri, bool _recursive,
const SongFilter *_filter=nullptr) noexcept; const SongFilter *_filter=nullptr) noexcept;
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept; bool IsEmpty() const noexcept;
/** /**
* Does this selection contain constraints other than "base"? * Does this selection contain constraints other than "base"?
*/ */
gcc_pure [[gnu::pure]]
bool HasOtherThanBase() const noexcept; bool HasOtherThanBase() const noexcept;
gcc_pure [[gnu::pure]]
bool Match(const LightSong &song) const noexcept; bool Match(const LightSong &song) const noexcept;
}; };
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_DIRECTORY_HXX #define MPD_DIRECTORY_HXX
#include "Ptr.hxx" #include "Ptr.hxx"
#include "util/Compiler.h"
#include "db/Visitor.hxx" #include "db/Visitor.hxx"
#include "db/PlaylistVector.hxx" #include "db/PlaylistVector.hxx"
#include "db/Ptr.hxx" #include "db/Ptr.hxx"
...@@ -113,7 +112,7 @@ public: ...@@ -113,7 +112,7 @@ public:
/** /**
* Create a new root #Directory object. * Create a new root #Directory object.
*/ */
gcc_malloc gcc_returns_nonnull [[gnu::malloc]] [[gnu::returns_nonnull]]
static Directory *NewRoot() noexcept { static Directory *NewRoot() noexcept {
return new Directory(std::string(), nullptr); return new Directory(std::string(), nullptr);
} }
...@@ -141,7 +140,7 @@ public: ...@@ -141,7 +140,7 @@ public:
* (e.g. #DEVICE_PLAYLIST) and whether the underlying plugin * (e.g. #DEVICE_PLAYLIST) and whether the underlying plugin
* is available. * is available.
*/ */
gcc_pure [[gnu::pure]]
bool IsPluginAvailable() const noexcept; bool IsPluginAvailable() const noexcept;
/** /**
...@@ -164,10 +163,10 @@ public: ...@@ -164,10 +163,10 @@ public:
/** /**
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
gcc_pure [[gnu::pure]]
const Directory *FindChild(std::string_view name) const noexcept; const Directory *FindChild(std::string_view name) const noexcept;
gcc_pure [[gnu::pure]]
Directory *FindChild(std::string_view name) noexcept { Directory *FindChild(std::string_view name) noexcept {
const Directory *cthis = this; const Directory *cthis = this;
return const_cast<Directory *>(cthis->FindChild(name)); return const_cast<Directory *>(cthis->FindChild(name));
...@@ -211,20 +210,20 @@ public: ...@@ -211,20 +210,20 @@ public:
* *
* @param uri the relative URI * @param uri the relative URI
*/ */
gcc_pure [[gnu::pure]]
LookupResult LookupDirectory(std::string_view uri) noexcept; LookupResult LookupDirectory(std::string_view uri) noexcept;
[[gnu::pure]] [[gnu::pure]]
bool TargetExists(std::string_view target) const noexcept; bool TargetExists(std::string_view target) const noexcept;
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return children.empty() && return children.empty() &&
songs.empty() && songs.empty() &&
playlists.empty(); playlists.empty();
} }
gcc_pure [[gnu::pure]]
const char *GetPath() const noexcept { const char *GetPath() const noexcept {
return path.c_str(); return path.c_str();
} }
...@@ -232,13 +231,13 @@ public: ...@@ -232,13 +231,13 @@ public:
/** /**
* Returns the base name of the directory. * Returns the base name of the directory.
*/ */
gcc_pure [[gnu::pure]]
const char *GetName() const noexcept; const char *GetName() const noexcept;
/** /**
* Is this the root directory of the music database? * Is this the root directory of the music database?
*/ */
gcc_pure [[gnu::pure]]
bool IsRoot() const noexcept { bool IsRoot() const noexcept {
return parent == nullptr; return parent == nullptr;
} }
...@@ -266,10 +265,10 @@ public: ...@@ -266,10 +265,10 @@ public:
* *
* Caller must lock the #db_mutex. * Caller must lock the #db_mutex.
*/ */
gcc_pure [[gnu::pure]]
const Song *FindSong(std::string_view name_utf8) const noexcept; const Song *FindSong(std::string_view name_utf8) const noexcept;
gcc_pure [[gnu::pure]]
Song *FindSong(std::string_view name_utf8) noexcept { Song *FindSong(std::string_view name_utf8) noexcept {
const Directory *cthis = this; const Directory *cthis = this;
return const_cast<Song *>(cthis->FindSong(name_utf8)); return const_cast<Song *>(cthis->FindSong(name_utf8));
...@@ -307,7 +306,7 @@ public: ...@@ -307,7 +306,7 @@ public:
const VisitDirectory& visit_directory, const VisitSong& visit_song, const VisitDirectory& visit_directory, const VisitSong& visit_song,
const VisitPlaylist& visit_playlist) const; const VisitPlaylist& visit_playlist) const;
gcc_pure [[gnu::pure]]
LightDirectory Export() const noexcept; LightDirectory Export() const noexcept;
}; };
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "db/Ptr.hxx" #include "db/Ptr.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "util/Manual.hxx" #include "util/Manual.hxx"
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#include <cassert> #include <cassert>
...@@ -78,7 +77,7 @@ public: ...@@ -78,7 +77,7 @@ public:
DatabaseListener &listener, DatabaseListener &listener,
const ConfigBlock &block); const ConfigBlock &block);
gcc_pure [[gnu::pure]]
Directory &GetRoot() noexcept { Directory &GetRoot() noexcept {
assert(root != NULL); assert(root != NULL);
...@@ -98,7 +97,7 @@ public: ...@@ -98,7 +97,7 @@ public:
* @param db the #Database to be mounted; must be "open"; on * @param db the #Database to be mounted; must be "open"; on
* success, this object gains ownership of the given #Database * success, this object gains ownership of the given #Database
*/ */
gcc_nonnull_all [[gnu::nonnull]]
void Mount(const char *uri, DatabasePtr db); void Mount(const char *uri, DatabasePtr db);
/** /**
...@@ -106,10 +105,10 @@ public: ...@@ -106,10 +105,10 @@ public:
* *
* @return false if the mounted database needs to be updated * @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); bool Mount(const char *local_uri, const char *storage_uri);
gcc_nonnull_all [[gnu::nonnull]]
bool Unmount(const char *uri) noexcept; bool Unmount(const char *uri) noexcept;
/* virtual methods from class Database */ /* virtual methods from class Database */
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "Chrono.hxx" #include "Chrono.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "pcm/AudioFormat.hxx" #include "pcm/AudioFormat.hxx"
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#include <boost/intrusive/list.hpp> #include <boost/intrusive/list.hpp>
...@@ -108,14 +107,14 @@ struct Song { ...@@ -108,14 +107,14 @@ struct Song {
Song(DetachedSong &&other, Directory &_parent) noexcept; Song(DetachedSong &&other, Directory &_parent) noexcept;
gcc_pure [[gnu::pure]]
const char *GetFilenameSuffix() const noexcept; const char *GetFilenameSuffix() const noexcept;
/** /**
* Checks whether the decoder plugin for this song is * Checks whether the decoder plugin for this song is
* available. * available.
*/ */
gcc_pure [[gnu::pure]]
bool IsPluginAvailable() const noexcept; bool IsPluginAvailable() const noexcept;
/** /**
...@@ -149,10 +148,10 @@ struct Song { ...@@ -149,10 +148,10 @@ struct Song {
* Returns the URI of the song in UTF-8 encoding, including its * Returns the URI of the song in UTF-8 encoding, including its
* location within the music directory. * location within the music directory.
*/ */
gcc_pure [[gnu::pure]]
std::string GetURI() const noexcept; std::string GetURI() const noexcept;
gcc_pure [[gnu::pure]]
ExportedSong Export() const noexcept; ExportedSong Export() const noexcept;
}; };
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/* this destructor exists here just so it won't get inlined */ /* this destructor exists here just so it won't get inlined */
UPnPDirContent::~UPnPDirContent() = default; UPnPDirContent::~UPnPDirContent() = default;
gcc_pure [[gnu::pure]]
static UPnPDirObject::ItemClass static UPnPDirObject::ItemClass
ParseItemClass(StringView name) noexcept ParseItemClass(StringView name) noexcept
{ {
...@@ -45,7 +45,7 @@ ParseItemClass(StringView name) noexcept ...@@ -45,7 +45,7 @@ ParseItemClass(StringView name) noexcept
return UPnPDirObject::ItemClass::UNKNOWN; return UPnPDirObject::ItemClass::UNKNOWN;
} }
gcc_pure [[gnu::pure]]
static SignedSongTime static SignedSongTime
ParseDuration(const char *duration) noexcept ParseDuration(const char *duration) noexcept
{ {
...@@ -73,7 +73,7 @@ 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 * elements. There is a very slight risk of collision in doing
* this. Twonky returns directory names (titles) like 'Artist/Album'. * this. Twonky returns directory names (titles) like 'Artist/Album'.
*/ */
gcc_pure [[gnu::pure]]
static std::string && static std::string &&
TitleToPathSegment(std::string &&s) noexcept TitleToPathSegment(std::string &&s) noexcept
{ {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_UPNP_DIRECTORY_HXX #define MPD_UPNP_DIRECTORY_HXX
#include "Object.hxx" #include "Object.hxx"
#include "util/Compiler.h"
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -39,7 +38,7 @@ public: ...@@ -39,7 +38,7 @@ public:
~UPnPDirContent(); ~UPnPDirContent();
gcc_pure [[gnu::pure]]
UPnPDirObject *FindObject(std::string_view name) noexcept { UPnPDirObject *FindObject(std::string_view name) noexcept {
for (auto &o : objects) for (auto &o : objects)
if (o.name == name) if (o.name == name)
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_UPNP_OBJECT_HXX #define MPD_UPNP_OBJECT_HXX
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "util/Compiler.h"
#include <string> #include <string>
...@@ -89,12 +88,12 @@ public: ...@@ -89,12 +88,12 @@ public:
tag.Clear(); tag.Clear();
} }
gcc_pure [[gnu::pure]]
bool IsRoot() const noexcept { bool IsRoot() const noexcept {
return type == Type::CONTAINER && id == "0"; return type == Type::CONTAINER && id == "0";
} }
gcc_pure [[gnu::pure]]
bool Check() const noexcept { bool Check() const noexcept {
return !id.empty() && return !id.empty() &&
/* root nodes don't need a parent id and a /* root nodes don't need a parent id and a
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#ifndef MPD_EXCLUDE_H #ifndef MPD_EXCLUDE_H
#define MPD_EXCLUDE_H #define MPD_EXCLUDE_H
#include "util/Compiler.h"
#include "fs/Glob.hxx" #include "fs/Glob.hxx"
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "config.h" #include "config.h"
...@@ -50,7 +49,7 @@ public: ...@@ -50,7 +49,7 @@ public:
ExcludeList(const ExcludeList &_parent) noexcept ExcludeList(const ExcludeList &_parent) noexcept
:parent(&_parent) {} :parent(&_parent) {}
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
#ifdef HAVE_CLASS_GLOB #ifdef HAVE_CLASS_GLOB
return ((parent == nullptr) || parent->IsEmpty()) && patterns.empty(); return ((parent == nullptr) || parent->IsEmpty()) && patterns.empty();
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_UPDATE_QUEUE_HXX #ifndef MPD_UPDATE_QUEUE_HXX
#define MPD_UPDATE_QUEUE_HXX #define MPD_UPDATE_QUEUE_HXX
#include "util/Compiler.h"
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <list> #include <list>
...@@ -61,7 +59,6 @@ class UpdateQueue { ...@@ -61,7 +59,6 @@ class UpdateQueue {
std::list<UpdateQueueItem> update_queue; std::list<UpdateQueueItem> update_queue;
public: public:
gcc_nonnull_all
bool Push(SimpleDatabase &db, Storage &storage, bool Push(SimpleDatabase &db, Storage &storage,
std::string_view path, bool discard, unsigned id) noexcept; std::string_view path, bool discard, unsigned id) noexcept;
...@@ -71,10 +68,8 @@ public: ...@@ -71,10 +68,8 @@ public:
update_queue.clear(); update_queue.clear();
} }
gcc_nonnull_all
void Erase(SimpleDatabase &db) noexcept; void Erase(SimpleDatabase &db) noexcept;
gcc_nonnull_all
void Erase(Storage &storage) noexcept; void Erase(Storage &storage) noexcept;
}; };
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "Queue.hxx" #include "Queue.hxx"
#include "event/InjectEvent.hxx" #include "event/InjectEvent.hxx"
#include "thread/Thread.hxx" #include "thread/Thread.hxx"
#include "util/Compiler.h"
#include <memory> #include <memory>
#include <string_view> #include <string_view>
...@@ -90,7 +89,6 @@ public: ...@@ -90,7 +89,6 @@ public:
* the whole music directory is updated * the whole music directory is updated
* @return the job id * @return the job id
*/ */
gcc_nonnull_all
unsigned Enqueue(std::string_view path, bool discard); unsigned Enqueue(std::string_view path, bool discard);
/** /**
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_UPDATE_IO_HXX #ifndef MPD_UPDATE_IO_HXX
#define MPD_UPDATE_IO_HXX #define MPD_UPDATE_IO_HXX
#include "util/Compiler.h"
#include <string_view> #include <string_view>
struct Directory; struct Directory;
...@@ -43,11 +41,11 @@ GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info) noexcept; ...@@ -43,11 +41,11 @@ GetInfo(Storage &storage, const char *uri_utf8, StorageFileInfo &info) noexcept;
bool bool
GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info) noexcept; GetInfo(StorageDirectoryReader &reader, StorageFileInfo &info) noexcept;
gcc_pure [[gnu::pure]]
bool bool
DirectoryExists(Storage &storage, const Directory &directory) noexcept; DirectoryExists(Storage &storage, const Directory &directory) noexcept;
gcc_pure [[gnu::pure]]
bool bool
directory_child_is_regular(Storage &storage, const Directory &directory, directory_child_is_regular(Storage &storage, const Directory &directory,
std::string_view name_utf8) noexcept; std::string_view name_utf8) noexcept;
...@@ -55,7 +53,7 @@ directory_child_is_regular(Storage &storage, const Directory &directory, ...@@ -55,7 +53,7 @@ directory_child_is_regular(Storage &storage, const Directory &directory,
/** /**
* Checks if the given permissions on the mapped file are given. * Checks if the given permissions on the mapped file are given.
*/ */
gcc_pure [[gnu::pure]]
bool bool
directory_child_access(Storage &storage, const Directory &directory, directory_child_access(Storage &storage, const Directory &directory,
std::string_view name, int mode) noexcept; std::string_view name, int mode) noexcept;
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "Config.hxx" #include "Config.hxx"
#include "Editor.hxx" #include "Editor.hxx"
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#include <atomic> #include <atomic>
...@@ -76,7 +75,7 @@ public: ...@@ -76,7 +75,7 @@ public:
bool Walk(Directory &root, const char *path, bool discard) noexcept; bool Walk(Directory &root, const char *path, bool discard) noexcept;
private: private:
gcc_pure [[gnu::pure]]
bool SkipSymlink(const Directory *directory, bool SkipSymlink(const Directory *directory,
std::string_view utf8_name) const noexcept; std::string_view utf8_name) const noexcept;
......
...@@ -132,7 +132,7 @@ public: ...@@ -132,7 +132,7 @@ public:
* *
* Caller must lock the #DecoderControl object. * Caller must lock the #DecoderControl object.
*/ */
gcc_pure [[gnu::pure]]
bool CheckCancelRead() const noexcept; bool CheckCancelRead() const noexcept;
/** /**
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "Command.hxx" #include "Command.hxx"
#include "Chrono.hxx" #include "Chrono.hxx"
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
...@@ -57,7 +56,7 @@ public: ...@@ -57,7 +56,7 @@ public:
* @return the current command, or DecoderCommand::NONE if there is no * @return the current command, or DecoderCommand::NONE if there is no
* command pending * command pending
*/ */
gcc_pure [[gnu::pure]]
virtual DecoderCommand GetCommand() noexcept = 0; virtual DecoderCommand GetCommand() noexcept = 0;
/** /**
...@@ -72,7 +71,7 @@ public: ...@@ -72,7 +71,7 @@ public:
* *
* @return the destination position for the seek * @return the destination position for the seek
*/ */
gcc_pure [[gnu::pure]]
virtual SongTime GetSeekTime() noexcept = 0; virtual SongTime GetSeekTime() noexcept = 0;
/** /**
...@@ -80,7 +79,7 @@ public: ...@@ -80,7 +79,7 @@ public:
* *
* @return the destination position for the seek in frames * @return the destination position for the seek in frames
*/ */
gcc_pure [[gnu::pure]]
virtual uint64_t GetSeekFrame() noexcept = 0; virtual uint64_t GetSeekFrame() noexcept = 0;
/** /**
......
...@@ -229,7 +229,7 @@ public: ...@@ -229,7 +229,7 @@ public:
state == DecoderState::ERROR; state == DecoderState::ERROR;
} }
gcc_pure [[gnu::pure]]
bool LockIsIdle() const noexcept { bool LockIsIdle() const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return IsIdle(); return IsIdle();
...@@ -239,7 +239,7 @@ public: ...@@ -239,7 +239,7 @@ public:
return state == DecoderState::START; return state == DecoderState::START;
} }
gcc_pure [[gnu::pure]]
bool LockIsStarting() const noexcept { bool LockIsStarting() const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return IsStarting(); return IsStarting();
...@@ -251,7 +251,7 @@ public: ...@@ -251,7 +251,7 @@ public:
return state == DecoderState::ERROR; return state == DecoderState::ERROR;
} }
gcc_pure [[gnu::pure]]
bool LockHasFailed() const noexcept { bool LockHasFailed() const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return HasFailed(); return HasFailed();
...@@ -307,15 +307,15 @@ public: ...@@ -307,15 +307,15 @@ public:
* *
* Caller must lock the object. * Caller must lock the object.
*/ */
gcc_pure [[gnu::pure]]
bool IsCurrentSong(const DetachedSong &_song) const noexcept; bool IsCurrentSong(const DetachedSong &_song) const noexcept;
gcc_pure [[gnu::pure]]
bool IsUnseekableCurrentSong(const DetachedSong &_song) const noexcept { bool IsUnseekableCurrentSong(const DetachedSong &_song) const noexcept {
return !seekable && IsCurrentSong(_song); return !seekable && IsCurrentSong(_song);
} }
gcc_pure [[gnu::pure]]
bool IsSeekableCurrentSong(const DetachedSong &_song) const noexcept { bool IsSeekableCurrentSong(const DetachedSong &_song) const noexcept {
return seekable && IsCurrentSong(_song); return seekable && IsCurrentSong(_song);
} }
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_DECODER_BUFFER_HXX #ifndef MPD_DECODER_BUFFER_HXX
#define MPD_DECODER_BUFFER_HXX #define MPD_DECODER_BUFFER_HXX
#include "util/Compiler.h"
#include "util/DynamicFifoBuffer.hxx" #include "util/DynamicFifoBuffer.hxx"
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
...@@ -74,7 +73,7 @@ public: ...@@ -74,7 +73,7 @@ public:
/** /**
* How many bytes are stored in the buffer? * How many bytes are stored in the buffer?
*/ */
gcc_pure [[gnu::pure]]
size_t GetAvailable() const noexcept { size_t GetAvailable() const noexcept {
return buffer.GetAvailable(); return buffer.GetAvailable();
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_DECODER_LIST_HXX #ifndef MPD_DECODER_LIST_HXX
#define MPD_DECODER_LIST_HXX #define MPD_DECODER_LIST_HXX
#include "util/Compiler.h"
#include <string_view> #include <string_view>
struct ConfigData; struct ConfigData;
...@@ -32,7 +30,7 @@ extern bool decoder_plugins_enabled[]; ...@@ -32,7 +30,7 @@ extern bool decoder_plugins_enabled[];
/* interface for using plugins */ /* interface for using plugins */
gcc_pure [[gnu::pure]]
const struct DecoderPlugin * const struct DecoderPlugin *
decoder_plugin_from_name(const char *name) noexcept; decoder_plugin_from_name(const char *name) noexcept;
...@@ -98,7 +96,7 @@ decoder_plugins_for_each_enabled(F f) ...@@ -98,7 +96,7 @@ decoder_plugins_for_each_enabled(F f)
* Is there at least once #DecoderPlugin that supports the specified * Is there at least once #DecoderPlugin that supports the specified
* file name suffix? * file name suffix?
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]]
bool bool
decoder_plugins_supports_suffix(std::string_view suffix) noexcept; decoder_plugins_supports_suffix(std::string_view suffix) noexcept;
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_DECODER_PLUGIN_HXX #ifndef MPD_DECODER_PLUGIN_HXX
#define MPD_DECODER_PLUGIN_HXX #define MPD_DECODER_PLUGIN_HXX
#include "util/Compiler.h"
#include <forward_list> // IWYU pragma: export #include <forward_list> // IWYU pragma: export
#include <set> #include <set>
#include <string> #include <string>
...@@ -246,19 +244,19 @@ struct DecoderPlugin { ...@@ -246,19 +244,19 @@ struct DecoderPlugin {
return container_scan(path, tnum); return container_scan(path, tnum);
} }
gcc_pure [[gnu::pure]]
bool SupportsUri(const char *uri) const noexcept; bool SupportsUri(const char *uri) const noexcept;
/** /**
* Does the plugin announce the specified file name suffix? * Does the plugin announce the specified file name suffix?
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]]
bool SupportsSuffix(std::string_view suffix) const noexcept; bool SupportsSuffix(std::string_view suffix) const noexcept;
/** /**
* Does the plugin announce the specified MIME type? * 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 SupportsMimeType(std::string_view mime_type) const noexcept;
bool SupportsContainerSuffix(std::string_view suffix) const noexcept { bool SupportsContainerSuffix(std::string_view suffix) const noexcept {
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "util/ByteOrder.hxx" #include "util/ByteOrder.hxx"
#include "input/Offset.hxx" #include "input/Offset.hxx"
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
...@@ -33,7 +32,7 @@ class InputStream; ...@@ -33,7 +32,7 @@ class InputStream;
struct DsdId { struct DsdId {
char value[4]; char value[4];
gcc_pure [[gnu::pure]]
bool Equals(const char *s) const noexcept; bool Equals(const char *s) const noexcept;
}; };
...@@ -70,7 +69,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is, ...@@ -70,7 +69,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is,
/** /**
* Check if the sample frequency is a valid DSD frequency. * Check if the sample frequency is a valid DSD frequency.
**/ **/
gcc_const [[gnu::const]]
bool bool
dsdlib_valid_freq(uint32_t samplefreq) noexcept; dsdlib_valid_freq(uint32_t samplefreq) noexcept;
......
...@@ -26,11 +26,9 @@ ...@@ -26,11 +26,9 @@
#ifndef MPD_FILTER_REGISTRY_HXX #ifndef MPD_FILTER_REGISTRY_HXX
#define MPD_FILTER_REGISTRY_HXX #define MPD_FILTER_REGISTRY_HXX
#include "util/Compiler.h"
struct FilterPlugin; struct FilterPlugin;
gcc_pure [[gnu::pure]]
const FilterPlugin * const FilterPlugin *
filter_plugin_by_name(const char *name) noexcept; filter_plugin_by_name(const char *name) noexcept;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_FS_ALLOCATED_PATH_HXX #ifndef MPD_FS_ALLOCATED_PATH_HXX
#define MPD_FS_ALLOCATED_PATH_HXX #define MPD_FS_ALLOCATED_PATH_HXX
#include "util/Compiler.h"
#include "Traits.hxx" #include "Traits.hxx"
#include "Path.hxx" #include "Path.hxx"
...@@ -81,7 +80,7 @@ public: ...@@ -81,7 +80,7 @@ public:
~AllocatedPath() noexcept; ~AllocatedPath() noexcept;
gcc_pure [[gnu::pure]]
operator Path() const noexcept { operator Path() const noexcept {
return Path::FromFS(c_str()); return Path::FromFS(c_str());
} }
...@@ -89,40 +88,40 @@ public: ...@@ -89,40 +88,40 @@ public:
/** /**
* Join two path components with the path separator. * Join two path components with the path separator.
*/ */
gcc_pure [[gnu::pure]]
static AllocatedPath Build(string_view a, string_view b) noexcept { static AllocatedPath Build(string_view a, string_view b) noexcept {
return AllocatedPath(Traits::Build(a, b)); return AllocatedPath(Traits::Build(a, b));
} }
gcc_pure gcc_nonnull_all [[gnu::pure]]
static AllocatedPath Build(Path a, string_view b) noexcept { static AllocatedPath Build(Path a, string_view b) noexcept {
return Build(a.c_str(), b); return Build(a.c_str(), b);
} }
gcc_pure gcc_nonnull_all [[gnu::pure]]
static AllocatedPath Build(Path a, Path b) noexcept { static AllocatedPath Build(Path a, Path b) noexcept {
return Build(a, b.c_str()); return Build(a, b.c_str());
} }
gcc_pure gcc_nonnull_all [[gnu::pure]]
static AllocatedPath Build(string_view a, static AllocatedPath Build(string_view a,
const AllocatedPath &b) noexcept { const AllocatedPath &b) noexcept {
return Build(a, b.value); return Build(a, b.value);
} }
gcc_pure gcc_nonnull_all [[gnu::pure]]
static AllocatedPath Build(const AllocatedPath &a, static AllocatedPath Build(const AllocatedPath &a,
string_view b) noexcept { string_view b) noexcept {
return Build(a.value, b); return Build(a.value, b);
} }
gcc_pure [[gnu::pure]]
static AllocatedPath Build(const AllocatedPath &a, static AllocatedPath Build(const AllocatedPath &a,
const AllocatedPath &b) noexcept { const AllocatedPath &b) noexcept {
return Build(a.value, b.value); return Build(a.value, b.value);
} }
gcc_pure [[gnu::pure]]
static AllocatedPath Apply(Path base, Path path) noexcept { static AllocatedPath Apply(Path base, Path path) noexcept {
return Traits::Apply(base.c_str(), path.c_str()); return Traits::Apply(base.c_str(), path.c_str());
} }
...@@ -131,17 +130,17 @@ public: ...@@ -131,17 +130,17 @@ public:
* Convert a C string that is already in the filesystem * Convert a C string that is already in the filesystem
* character set to a #Path instance. * character set to a #Path instance.
*/ */
gcc_pure [[gnu::pure]]
static AllocatedPath FromFS(const_pointer fs) noexcept { static AllocatedPath FromFS(const_pointer fs) noexcept {
return AllocatedPath(fs); return AllocatedPath(fs);
} }
gcc_pure [[gnu::pure]]
static AllocatedPath FromFS(string_view fs) noexcept { static AllocatedPath FromFS(string_view fs) noexcept {
return AllocatedPath(fs); return AllocatedPath(fs);
} }
gcc_pure [[gnu::pure]]
static AllocatedPath FromFS(const_pointer _begin, static AllocatedPath FromFS(const_pointer _begin,
const_pointer _end) noexcept { const_pointer _end) noexcept {
return AllocatedPath(_begin, _end); return AllocatedPath(_begin, _end);
...@@ -151,13 +150,13 @@ public: ...@@ -151,13 +150,13 @@ public:
* Convert a C++ string that is already in the filesystem * Convert a C++ string that is already in the filesystem
* character set to a #Path instance. * character set to a #Path instance.
*/ */
gcc_pure [[gnu::pure]]
static AllocatedPath FromFS(string &&fs) noexcept { static AllocatedPath FromFS(string &&fs) noexcept {
return AllocatedPath(std::move(fs)); return AllocatedPath(std::move(fs));
} }
#ifdef ANDROID #ifdef ANDROID
gcc_pure [[gnu::pure]]
static AllocatedPath FromUTF8(std::string &&utf8) noexcept { static AllocatedPath FromUTF8(std::string &&utf8) noexcept {
/* on Android, the filesystem charset is hard-coded to /* on Android, the filesystem charset is hard-coded to
UTF-8 */ UTF-8 */
...@@ -173,7 +172,7 @@ public: ...@@ -173,7 +172,7 @@ public:
* Convert a UTF-8 C string to an #AllocatedPath instance. * Convert a UTF-8 C string to an #AllocatedPath instance.
* Returns return a "nulled" instance on error. * Returns return a "nulled" instance on error.
*/ */
gcc_pure [[gnu::pure]]
static AllocatedPath FromUTF8(std::string_view path_utf8) noexcept; static AllocatedPath FromUTF8(std::string_view path_utf8) noexcept;
static AllocatedPath FromUTF8(const char *path_utf8) noexcept { static AllocatedPath FromUTF8(const char *path_utf8) noexcept {
...@@ -199,12 +198,12 @@ public: ...@@ -199,12 +198,12 @@ public:
return *this; return *this;
} }
gcc_pure [[gnu::pure]]
bool operator==(const AllocatedPath &other) const noexcept { bool operator==(const AllocatedPath &other) const noexcept {
return value == other.value; return value == other.value;
} }
gcc_pure [[gnu::pure]]
bool operator!=(const AllocatedPath &other) const noexcept { bool operator!=(const AllocatedPath &other) const noexcept {
return value != other.value; return value != other.value;
} }
...@@ -238,7 +237,7 @@ public: ...@@ -238,7 +237,7 @@ public:
* @return the length of this string in number of "value_type" * @return the length of this string in number of "value_type"
* elements (which may not be the number of characters). * elements (which may not be the number of characters).
*/ */
gcc_pure [[gnu::pure]]
size_t length() const noexcept { size_t length() const noexcept {
return value.length(); return value.length();
} }
...@@ -248,7 +247,7 @@ public: ...@@ -248,7 +247,7 @@ public:
* pointer is invalidated whenever the value of life of this * pointer is invalidated whenever the value of life of this
* instance ends. * instance ends.
*/ */
gcc_pure [[gnu::pure]]
const_pointer c_str() const noexcept { const_pointer c_str() const noexcept {
return value.c_str(); return value.c_str();
} }
...@@ -257,7 +256,7 @@ public: ...@@ -257,7 +256,7 @@ public:
* Returns a pointer to the raw value, not necessarily * Returns a pointer to the raw value, not necessarily
* null-terminated. * null-terminated.
*/ */
gcc_pure [[gnu::pure]]
const_pointer data() const noexcept { const_pointer data() const noexcept {
return value.data(); return value.data();
} }
...@@ -267,7 +266,7 @@ public: ...@@ -267,7 +266,7 @@ public:
* Returns empty string on error or if this instance is "nulled" * Returns empty string on error or if this instance is "nulled"
* (#IsNull returns true). * (#IsNull returns true).
*/ */
gcc_pure [[gnu::pure]]
std::string ToUTF8() const noexcept { std::string ToUTF8() const noexcept {
return ((Path)*this).ToUTF8(); return ((Path)*this).ToUTF8();
} }
...@@ -280,7 +279,7 @@ public: ...@@ -280,7 +279,7 @@ public:
* Gets directory name of this path. * Gets directory name of this path.
* Returns a "nulled" instance on error. * Returns a "nulled" instance on error.
*/ */
gcc_pure [[gnu::pure]]
AllocatedPath GetDirectoryName() const noexcept { AllocatedPath GetDirectoryName() const noexcept {
return ((Path)*this).GetDirectoryName(); return ((Path)*this).GetDirectoryName();
} }
...@@ -291,12 +290,12 @@ public: ...@@ -291,12 +290,12 @@ public:
* empty string if the given path equals this object or * empty string if the given path equals this object or
* nullptr on mismatch. * nullptr on mismatch.
*/ */
gcc_pure [[gnu::pure]]
const_pointer Relative(Path other_fs) const noexcept { const_pointer Relative(Path other_fs) const noexcept {
return Traits::Relative(c_str(), other_fs.c_str()); return Traits::Relative(c_str(), other_fs.c_str());
} }
gcc_pure [[gnu::pure]]
const_pointer GetSuffix() const noexcept { const_pointer GetSuffix() const noexcept {
return ((Path)*this).GetSuffix(); return ((Path)*this).GetSuffix();
} }
...@@ -306,7 +305,7 @@ public: ...@@ -306,7 +305,7 @@ public:
*/ */
void ChopSeparators() noexcept; void ChopSeparators() noexcept;
gcc_pure [[gnu::pure]]
bool IsAbsolute() const noexcept { bool IsAbsolute() const noexcept {
return Traits::IsAbsolute(c_str()); return Traits::IsAbsolute(c_str());
} }
......
...@@ -20,13 +20,12 @@ ...@@ -20,13 +20,12 @@
#ifndef MPD_FS_CHARSET_HXX #ifndef MPD_FS_CHARSET_HXX
#define MPD_FS_CHARSET_HXX #define MPD_FS_CHARSET_HXX
#include "util/Compiler.h"
#include "Traits.hxx" #include "Traits.hxx"
/** /**
* Gets file system character set name. * Gets file system character set name.
*/ */
gcc_const [[gnu::const]]
const char * const char *
GetFSCharset() noexcept; GetFSCharset() noexcept;
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#endif #endif
#ifdef HAVE_CLASS_GLOB #ifdef HAVE_CLASS_GLOB
#include "util/Compiler.h"
#include <string> #include <string>
/** /**
...@@ -48,7 +46,7 @@ public: ...@@ -48,7 +46,7 @@ public:
Glob(Glob &&other) noexcept = default; Glob(Glob &&other) noexcept = default;
Glob &operator=(Glob &&other) noexcept = default; Glob &operator=(Glob &&other) noexcept = default;
gcc_pure [[gnu::pure]]
bool Check(const char *name_fs) const noexcept; bool Check(const char *name_fs) const noexcept;
}; };
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_FS_PATH_HXX #ifndef MPD_FS_PATH_HXX
#define MPD_FS_PATH_HXX #define MPD_FS_PATH_HXX
#include "util/Compiler.h"
#include "Traits.hxx" #include "Traits.hxx"
#include <cassert> #include <cassert>
...@@ -88,7 +87,7 @@ public: ...@@ -88,7 +87,7 @@ public:
* @return the length of this string in number of "value_type" * @return the length of this string in number of "value_type"
* elements (which may not be the number of characters). * elements (which may not be the number of characters).
*/ */
gcc_pure [[gnu::pure]]
size_t length() const noexcept { size_t length() const noexcept {
assert(!IsNull()); assert(!IsNull());
...@@ -117,7 +116,7 @@ public: ...@@ -117,7 +116,7 @@ public:
* usually rejected by MPD because its protocol cannot * usually rejected by MPD because its protocol cannot
* transfer newline characters). * transfer newline characters).
*/ */
gcc_pure [[gnu::pure]]
bool HasNewline() const noexcept { bool HasNewline() const noexcept {
return Traits::Find(c_str(), '\n') != nullptr; return Traits::Find(c_str(), '\n') != nullptr;
} }
...@@ -127,7 +126,7 @@ public: ...@@ -127,7 +126,7 @@ public:
* Returns empty string on error or if this instance is "nulled" * Returns empty string on error or if this instance is "nulled"
* (#IsNull returns true). * (#IsNull returns true).
*/ */
gcc_pure [[gnu::pure]]
std::string ToUTF8() const noexcept; std::string ToUTF8() const noexcept;
/** /**
...@@ -139,7 +138,7 @@ public: ...@@ -139,7 +138,7 @@ public:
* Determine the "base" file name. * Determine the "base" file name.
* The return value points inside this object. * The return value points inside this object.
*/ */
gcc_pure [[gnu::pure]]
Path GetBase() const noexcept { Path GetBase() const noexcept {
return FromFS(Traits::GetBase(c_str())); return FromFS(Traits::GetBase(c_str()));
} }
...@@ -148,7 +147,7 @@ public: ...@@ -148,7 +147,7 @@ public:
* Gets directory name of this path. * Gets directory name of this path.
* Returns a "nulled" instance on error. * Returns a "nulled" instance on error.
*/ */
gcc_pure [[gnu::pure]]
AllocatedPath GetDirectoryName() const noexcept; AllocatedPath GetDirectoryName() const noexcept;
/** /**
...@@ -157,17 +156,17 @@ public: ...@@ -157,17 +156,17 @@ public:
* empty string if the given path equals this object or * empty string if the given path equals this object or
* nullptr on mismatch. * nullptr on mismatch.
*/ */
gcc_pure [[gnu::pure]]
const_pointer Relative(Path other_fs) const noexcept { const_pointer Relative(Path other_fs) const noexcept {
return Traits::Relative(c_str(), other_fs.c_str()); return Traits::Relative(c_str(), other_fs.c_str());
} }
gcc_pure [[gnu::pure]]
bool IsAbsolute() const noexcept { bool IsAbsolute() const noexcept {
return Traits::IsAbsolute(c_str()); return Traits::IsAbsolute(c_str());
} }
gcc_pure [[gnu::pure]]
const_pointer GetSuffix() const noexcept; const_pointer GetSuffix() const noexcept;
}; };
......
...@@ -37,7 +37,7 @@ GetUserMusicDir() noexcept; ...@@ -37,7 +37,7 @@ GetUserMusicDir() noexcept;
/** /**
* Obtains cache directory for the current user. * Obtains cache directory for the current user.
*/ */
gcc_pure [[gnu::pure]]
AllocatedPath AllocatedPath
GetUserCacheDir() noexcept; GetUserCacheDir() noexcept;
......
...@@ -71,7 +71,7 @@ struct PathTraitsFS { ...@@ -71,7 +71,7 @@ struct PathTraitsFS {
ch == SEPARATOR; ch == SEPARATOR;
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static const_pointer FindLastSeparator(const_pointer p) noexcept { static const_pointer FindLastSeparator(const_pointer p) noexcept {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
...@@ -100,7 +100,7 @@ struct PathTraitsFS { ...@@ -100,7 +100,7 @@ struct PathTraitsFS {
#endif #endif
} }
gcc_pure [[gnu::pure]]
static const_pointer GetFilenameSuffix(const_pointer filename) noexcept { static const_pointer GetFilenameSuffix(const_pointer filename) noexcept {
const_pointer dot = StringFindLast(filename, '.'); const_pointer dot = StringFindLast(filename, '.');
return dot != nullptr && dot > filename && dot[1] != 0 return dot != nullptr && dot > filename && dot[1] != 0
...@@ -108,13 +108,13 @@ struct PathTraitsFS { ...@@ -108,13 +108,13 @@ struct PathTraitsFS {
: nullptr; : nullptr;
} }
gcc_pure [[gnu::pure]]
static const_pointer GetPathSuffix(const_pointer path) noexcept { static const_pointer GetPathSuffix(const_pointer path) noexcept {
return GetFilenameSuffix(GetBase(path)); return GetFilenameSuffix(GetBase(path));
} }
#ifdef _WIN32 #ifdef _WIN32
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static constexpr bool IsDrive(const_pointer p) noexcept { static constexpr bool IsDrive(const_pointer p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':'; return IsAlphaASCII(p[0]) && p[1] == ':';
} }
...@@ -124,7 +124,7 @@ struct PathTraitsFS { ...@@ -124,7 +124,7 @@ struct PathTraitsFS {
} }
#endif #endif
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static bool IsAbsolute(const_pointer p) noexcept { static bool IsAbsolute(const_pointer p) noexcept {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
...@@ -138,18 +138,18 @@ struct PathTraitsFS { ...@@ -138,18 +138,18 @@ struct PathTraitsFS {
return IsSeparator(*p); return IsSeparator(*p);
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static bool IsSpecialFilename(const_pointer name) noexcept { static bool IsSpecialFilename(const_pointer name) noexcept {
return (name[0] == '.' && name[1] == 0) || return (name[0] == '.' && name[1] == 0) ||
(name[0] == '.' && name[1] == '.' && name[2] == 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 { static size_t GetLength(const_pointer p) noexcept {
return StringLength(p); return StringLength(p);
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static const_pointer Find(const_pointer p, value_type ch) noexcept { static const_pointer Find(const_pointer p, value_type ch) noexcept {
return StringFind(p, ch); return StringFind(p, ch);
} }
...@@ -158,7 +158,7 @@ struct PathTraitsFS { ...@@ -158,7 +158,7 @@ struct PathTraitsFS {
* Determine the "base" file name of the given native path. * Determine the "base" file name of the given native path.
* The return value points inside the given string. * 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; static const_pointer GetBase(const_pointer p) noexcept;
/** /**
...@@ -166,7 +166,7 @@ struct PathTraitsFS { ...@@ -166,7 +166,7 @@ struct PathTraitsFS {
* As a special case, returns the string "." if there is no * As a special case, returns the string "." if there is no
* separator in the given input string. * separator in the given input string.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static string_view GetParent(const_pointer p) noexcept; static string_view GetParent(const_pointer p) noexcept;
[[gnu::pure]] [[gnu::pure]]
...@@ -178,10 +178,10 @@ struct PathTraitsFS { ...@@ -178,10 +178,10 @@ struct PathTraitsFS {
* empty string if the given path equals this object or * empty string if the given path equals this object or
* nullptr on mismatch. * nullptr on mismatch.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static const_pointer Relative(string_view base, const_pointer other) noexcept; 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; static string_view Relative(string_view base, string_view other) noexcept;
/** /**
...@@ -190,14 +190,14 @@ struct PathTraitsFS { ...@@ -190,14 +190,14 @@ struct PathTraitsFS {
* remaining component is returned unchanged. * remaining component is returned unchanged.
* If both components are empty strings, empty string is returned. * If both components are empty strings, empty string is returned.
*/ */
gcc_pure [[gnu::pure]]
static string Build(string_view a, string_view b) noexcept; static string Build(string_view a, string_view b) noexcept;
/** /**
* Interpret the given path as being relative to the given * Interpret the given path as being relative to the given
* base, and return the concatenated path. * base, and return the concatenated path.
*/ */
gcc_pure [[gnu::pure]]
static string Apply(const_pointer base, static string Apply(const_pointer base,
const_pointer path) noexcept; const_pointer path) noexcept;
}; };
...@@ -221,7 +221,7 @@ struct PathTraitsUTF8 { ...@@ -221,7 +221,7 @@ struct PathTraitsUTF8 {
return ch == SEPARATOR; return ch == SEPARATOR;
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static const_pointer FindLastSeparator(const_pointer p) noexcept { static const_pointer FindLastSeparator(const_pointer p) noexcept {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
...@@ -236,7 +236,7 @@ struct PathTraitsUTF8 { ...@@ -236,7 +236,7 @@ struct PathTraitsUTF8 {
return StringFindLast(p.data(), SEPARATOR, p.size()); return StringFindLast(p.data(), SEPARATOR, p.size());
} }
gcc_pure [[gnu::pure]]
static const_pointer GetFilenameSuffix(const_pointer filename) noexcept { static const_pointer GetFilenameSuffix(const_pointer filename) noexcept {
const_pointer dot = StringFindLast(filename, '.'); const_pointer dot = StringFindLast(filename, '.');
return dot != nullptr && dot > filename && dot[1] != 0 return dot != nullptr && dot > filename && dot[1] != 0
...@@ -244,13 +244,13 @@ struct PathTraitsUTF8 { ...@@ -244,13 +244,13 @@ struct PathTraitsUTF8 {
: nullptr; : nullptr;
} }
gcc_pure [[gnu::pure]]
static const_pointer GetPathSuffix(const_pointer path) noexcept { static const_pointer GetPathSuffix(const_pointer path) noexcept {
return GetFilenameSuffix(GetBase(path)); return GetFilenameSuffix(GetBase(path));
} }
#ifdef _WIN32 #ifdef _WIN32
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static constexpr bool IsDrive(const_pointer p) noexcept { static constexpr bool IsDrive(const_pointer p) noexcept {
return IsAlphaASCII(p[0]) && p[1] == ':'; return IsAlphaASCII(p[0]) && p[1] == ':';
} }
...@@ -260,7 +260,7 @@ struct PathTraitsUTF8 { ...@@ -260,7 +260,7 @@ struct PathTraitsUTF8 {
} }
#endif #endif
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static bool IsAbsolute(const_pointer p) noexcept { static bool IsAbsolute(const_pointer p) noexcept {
#if !CLANG_CHECK_VERSION(3,6) #if !CLANG_CHECK_VERSION(3,6)
/* disabled on clang due to -Wtautological-pointer-compare */ /* disabled on clang due to -Wtautological-pointer-compare */
...@@ -281,18 +281,18 @@ struct PathTraitsUTF8 { ...@@ -281,18 +281,18 @@ struct PathTraitsUTF8 {
[[gnu::pure]] [[gnu::nonnull]] [[gnu::pure]] [[gnu::nonnull]]
static bool IsAbsoluteOrHasScheme(const_pointer p) noexcept; static bool IsAbsoluteOrHasScheme(const_pointer p) noexcept;
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static bool IsSpecialFilename(const_pointer name) noexcept { static bool IsSpecialFilename(const_pointer name) noexcept {
return (name[0] == '.' && name[1] == 0) || return (name[0] == '.' && name[1] == 0) ||
(name[0] == '.' && name[1] == '.' && name[2] == 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 { static size_t GetLength(const_pointer p) noexcept {
return StringLength(p); return StringLength(p);
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static const_pointer Find(const_pointer p, value_type ch) noexcept { static const_pointer Find(const_pointer p, value_type ch) noexcept {
return StringFind(p, ch); return StringFind(p, ch);
} }
...@@ -301,7 +301,7 @@ struct PathTraitsUTF8 { ...@@ -301,7 +301,7 @@ struct PathTraitsUTF8 {
* Determine the "base" file name of the given UTF-8 path. * Determine the "base" file name of the given UTF-8 path.
* The return value points inside the given string. * 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; static const_pointer GetBase(const_pointer p) noexcept;
/** /**
...@@ -309,7 +309,7 @@ struct PathTraitsUTF8 { ...@@ -309,7 +309,7 @@ struct PathTraitsUTF8 {
* As a special case, returns the string "." if there is no * As a special case, returns the string "." if there is no
* separator in the given input string. * separator in the given input string.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static string_view GetParent(const_pointer p) noexcept; static string_view GetParent(const_pointer p) noexcept;
[[gnu::pure]] [[gnu::pure]]
...@@ -321,10 +321,10 @@ struct PathTraitsUTF8 { ...@@ -321,10 +321,10 @@ struct PathTraitsUTF8 {
* empty string if the given path equals this object or * empty string if the given path equals this object or
* nullptr on mismatch. * nullptr on mismatch.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static const_pointer Relative(string_view base, const_pointer other) noexcept; 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; static string_view Relative(string_view base, string_view other) noexcept;
/** /**
...@@ -333,7 +333,7 @@ struct PathTraitsUTF8 { ...@@ -333,7 +333,7 @@ struct PathTraitsUTF8 {
* remaining component is returned unchanged. * remaining component is returned unchanged.
* If both components are empty strings, empty string is returned. * If both components are empty strings, empty string is returned.
*/ */
gcc_pure [[gnu::pure]]
static string Build(string_view a, string_view b) noexcept; static string Build(string_view a, string_view b) noexcept;
}; };
......
...@@ -25,7 +25,7 @@ AutoGunzipReader::AutoGunzipReader(Reader &_next) noexcept ...@@ -25,7 +25,7 @@ AutoGunzipReader::AutoGunzipReader(Reader &_next) noexcept
AutoGunzipReader::~AutoGunzipReader() noexcept = default; AutoGunzipReader::~AutoGunzipReader() noexcept = default;
gcc_pure [[gnu::pure]]
static bool static bool
IsGzip(const uint8_t data[4]) noexcept IsGzip(const uint8_t data[4]) noexcept
{ {
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
#ifndef BUFFERED_READER_HXX #ifndef BUFFERED_READER_HXX
#define BUFFERED_READER_HXX #define BUFFERED_READER_HXX
#include "util/Compiler.h"
#include "util/DynamicFifoBuffer.hxx" #include "util/DynamicFifoBuffer.hxx"
#include <cstddef> #include <cstddef>
...@@ -64,7 +63,7 @@ public: ...@@ -64,7 +63,7 @@ public:
bool Fill(bool need_more); bool Fill(bool need_more);
gcc_pure [[gnu::pure]]
WritableBuffer<void> Read() const noexcept { WritableBuffer<void> Read() const noexcept {
return buffer.Read().ToVoid(); return buffer.Read().ToVoid();
} }
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "OutputStream.hxx" #include "OutputStream.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "util/Compiler.h"
#ifndef _WIN32 #ifndef _WIN32
#include "io/FileDescriptor.hxx" #include "io/FileDescriptor.hxx"
...@@ -133,7 +132,7 @@ public: ...@@ -133,7 +132,7 @@ public:
return path; return path;
} }
gcc_pure [[gnu::pure]]
uint64_t Tell() const noexcept; uint64_t Tell() const noexcept;
/* virtual methods from class OutputStream */ /* virtual methods from class OutputStream */
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "Reader.hxx" #include "Reader.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "util/Compiler.h"
#ifdef _WIN32 #ifdef _WIN32
#include <fileapi.h> #include <fileapi.h>
...@@ -94,7 +93,7 @@ public: ...@@ -94,7 +93,7 @@ public:
FileInfo GetFileInfo() const; FileInfo GetFileInfo() const;
gcc_pure [[gnu::pure]]
uint64_t GetSize() const noexcept { uint64_t GetSize() const noexcept {
#ifdef _WIN32 #ifdef _WIN32
LARGE_INTEGER size; LARGE_INTEGER size;
...@@ -106,7 +105,7 @@ public: ...@@ -106,7 +105,7 @@ public:
#endif #endif
} }
gcc_pure [[gnu::pure]]
uint64_t GetPosition() const noexcept { uint64_t GetPosition() const noexcept {
#ifdef _WIN32 #ifdef _WIN32
LARGE_INTEGER zero; LARGE_INTEGER zero;
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#ifndef READER_HXX #ifndef READER_HXX
#define READER_HXX #define READER_HXX
#include "util/Compiler.h"
#include <cstddef> #include <cstddef>
/** /**
...@@ -52,7 +50,7 @@ public: ...@@ -52,7 +50,7 @@ public:
* @return the number of bytes read into the given buffer or 0 * @return the number of bytes read into the given buffer or 0
* on end-of-stream * on end-of-stream
*/ */
gcc_nonnull_all [[gnu::nonnull]]
virtual size_t Read(void *data, size_t size) = 0; virtual size_t Read(void *data, size_t size) = 0;
}; };
......
...@@ -123,7 +123,7 @@ protected: ...@@ -123,7 +123,7 @@ protected:
/** /**
* Determine how many bytes can be added to the buffer. * Determine how many bytes can be added to the buffer.
*/ */
gcc_pure [[gnu::pure]]
size_t GetBufferSpace() const noexcept { size_t GetBufferSpace() const noexcept {
return buffer.GetSpace(); return buffer.GetSpace();
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef INPUT_ERROR_HXX #ifndef INPUT_ERROR_HXX
#define INPUT_ERROR_HXX #define INPUT_ERROR_HXX
#include "util/Compiler.h"
#include <exception> #include <exception>
/** /**
...@@ -29,7 +27,7 @@ ...@@ -29,7 +27,7 @@
* exist? This function attempts to recognize exceptions thrown by * exist? This function attempts to recognize exceptions thrown by
* various input plugins. * various input plugins.
*/ */
gcc_pure [[gnu::pure]]
bool bool
IsFileNotFound(std::exception_ptr e) noexcept; IsFileNotFound(std::exception_ptr e) noexcept;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_ICY_INPUT_STREAM_HXX #define MPD_ICY_INPUT_STREAM_HXX
#include "ProxyInputStream.hxx" #include "ProxyInputStream.hxx"
#include "util/Compiler.h"
#include <memory> #include <memory>
...@@ -63,7 +62,7 @@ public: ...@@ -63,7 +62,7 @@ public:
IcyInputStream(const IcyInputStream &) = delete; IcyInputStream(const IcyInputStream &) = delete;
IcyInputStream &operator=(const IcyInputStream &) = delete; IcyInputStream &operator=(const IcyInputStream &) = delete;
gcc_pure [[gnu::pure]]
bool IsEnabled() const noexcept; bool IsEnabled() const noexcept;
/* virtual methods from InputStream */ /* virtual methods from InputStream */
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "Ptr.hxx" #include "Ptr.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
#include <set> #include <set>
...@@ -83,7 +82,7 @@ struct InputPlugin { ...@@ -83,7 +82,7 @@ struct InputPlugin {
std::unique_ptr<RemoteTagScanner> (*scan_tags)(const char *uri, std::unique_ptr<RemoteTagScanner> (*scan_tags)(const char *uri,
RemoteTagHandler &handler) = nullptr; RemoteTagHandler &handler) = nullptr;
gcc_pure [[gnu::pure]]
bool SupportsUri(const char *uri) const noexcept; bool SupportsUri(const char *uri) const noexcept;
template<typename F> template<typename F>
...@@ -103,7 +102,7 @@ struct InputPlugin { ...@@ -103,7 +102,7 @@ struct InputPlugin {
} }
}; };
gcc_pure [[gnu::pure]]
bool bool
protocol_is_whitelisted(const char *proto) noexcept; protocol_is_whitelisted(const char *proto) noexcept;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "Offset.hxx" #include "Offset.hxx"
#include "Ptr.hxx" #include "Ptr.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
#include <memory> #include <memory>
...@@ -123,14 +122,12 @@ public: ...@@ -123,14 +122,12 @@ public:
* notifications * notifications
* @return an #InputStream object on success * @return an #InputStream object on success
*/ */
gcc_nonnull(1)
static InputStreamPtr Open(const char *uri, Mutex &mutex); static InputStreamPtr Open(const char *uri, Mutex &mutex);
/** /**
* Just like Open(), but waits for the stream to become ready. * Just like Open(), but waits for the stream to become ready.
* It is a wrapper for Open(), WaitReady() and Check(). * It is a wrapper for Open(), WaitReady() and Check().
*/ */
gcc_nonnull(1)
static InputStreamPtr OpenReady(const char *uri, Mutex &mutex); static InputStreamPtr OpenReady(const char *uri, Mutex &mutex);
/** /**
...@@ -184,14 +181,14 @@ public: ...@@ -184,14 +181,14 @@ public:
return ready; return ready;
} }
gcc_pure [[gnu::pure]]
bool HasMimeType() const noexcept { bool HasMimeType() const noexcept {
assert(ready); assert(ready);
return !mime.empty(); return !mime.empty();
} }
gcc_pure [[gnu::pure]]
const char *GetMimeType() const noexcept { const char *GetMimeType() const noexcept {
assert(ready); assert(ready);
...@@ -202,7 +199,7 @@ public: ...@@ -202,7 +199,7 @@ public:
mime.clear(); mime.clear();
} }
gcc_nonnull_all [[gnu::nonnull]]
void SetMimeType(const char *_mime) noexcept { void SetMimeType(const char *_mime) noexcept {
assert(!ready); assert(!ready);
...@@ -215,14 +212,14 @@ public: ...@@ -215,14 +212,14 @@ public:
mime = std::move(_mime); mime = std::move(_mime);
} }
gcc_pure [[gnu::pure]]
bool KnownSize() const noexcept { bool KnownSize() const noexcept {
assert(ready); assert(ready);
return size != UNKNOWN_SIZE; return size != UNKNOWN_SIZE;
} }
gcc_pure [[gnu::pure]]
offset_type GetSize() const noexcept { offset_type GetSize() const noexcept {
assert(ready); assert(ready);
assert(KnownSize()); assert(KnownSize());
...@@ -236,14 +233,14 @@ public: ...@@ -236,14 +233,14 @@ public:
offset += delta; offset += delta;
} }
gcc_pure [[gnu::pure]]
offset_type GetOffset() const noexcept { offset_type GetOffset() const noexcept {
assert(ready); assert(ready);
return offset; return offset;
} }
gcc_pure [[gnu::pure]]
offset_type GetRest() const noexcept { offset_type GetRest() const noexcept {
assert(ready); assert(ready);
assert(KnownSize()); assert(KnownSize());
...@@ -251,7 +248,7 @@ public: ...@@ -251,7 +248,7 @@ public:
return size - offset; return size - offset;
} }
gcc_pure [[gnu::pure]]
bool IsSeekable() const noexcept { bool IsSeekable() const noexcept {
assert(ready); assert(ready);
...@@ -261,7 +258,7 @@ public: ...@@ -261,7 +258,7 @@ public:
/** /**
* Determines whether seeking is cheap. This is true for local files. * Determines whether seeking is cheap. This is true for local files.
*/ */
gcc_pure [[gnu::pure]]
bool CheapSeeking() const noexcept; bool CheapSeeking() const noexcept;
/** /**
...@@ -313,14 +310,14 @@ public: ...@@ -313,14 +310,14 @@ public:
* *
* The caller must lock the mutex. * The caller must lock the mutex.
*/ */
gcc_pure [[gnu::pure]]
virtual bool IsEOF() const noexcept = 0; virtual bool IsEOF() const noexcept = 0;
/** /**
* Wrapper for IsEOF() which locks and unlocks the mutex; the * Wrapper for IsEOF() which locks and unlocks the mutex; the
* caller must not be holding it already. * caller must not be holding it already.
*/ */
gcc_pure [[gnu::pure]]
bool LockIsEOF() const noexcept; bool LockIsEOF() const noexcept;
/** /**
...@@ -346,7 +343,7 @@ public: ...@@ -346,7 +343,7 @@ public:
* *
* The caller must lock the mutex. * The caller must lock the mutex.
*/ */
gcc_pure [[gnu::pure]]
virtual bool IsAvailable() const noexcept; virtual bool IsAvailable() const noexcept;
/** /**
...@@ -363,7 +360,7 @@ public: ...@@ -363,7 +360,7 @@ public:
* @param size the maximum number of bytes to read * @param size the maximum number of bytes to read
* @return the number of bytes read * @return the number of bytes read
*/ */
gcc_nonnull_all [[gnu::nonnull]]
virtual size_t Read(std::unique_lock<Mutex> &lock, virtual size_t Read(std::unique_lock<Mutex> &lock,
void *ptr, size_t size) = 0; void *ptr, size_t size) = 0;
...@@ -373,7 +370,7 @@ public: ...@@ -373,7 +370,7 @@ public:
* *
* Throws std::runtime_error on error. * Throws std::runtime_error on error.
*/ */
gcc_nonnull_all [[gnu::nonnull]]
size_t LockRead(void *ptr, size_t size); size_t LockRead(void *ptr, size_t size);
/** /**
...@@ -387,7 +384,7 @@ public: ...@@ -387,7 +384,7 @@ public:
* @param size the number of bytes to read * @param size the number of bytes to read
* @return true if the whole data was read, false otherwise. * @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); void ReadFull(std::unique_lock<Mutex> &lock, void *ptr, size_t size);
/** /**
...@@ -396,7 +393,7 @@ public: ...@@ -396,7 +393,7 @@ public:
* *
* Throws std::runtime_error on error. * Throws std::runtime_error on error.
*/ */
gcc_nonnull_all [[gnu::nonnull]]
void LockReadFull(void *ptr, size_t size); void LockReadFull(void *ptr, size_t size);
protected: protected:
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_INPUT_REGISTRY_HXX #ifndef MPD_INPUT_REGISTRY_HXX
#define MPD_INPUT_REGISTRY_HXX #define MPD_INPUT_REGISTRY_HXX
#include "util/Compiler.h"
/** /**
* NULL terminated list of all input plugins which were enabled at * NULL terminated list of all input plugins which were enabled at
* compile time. * compile time.
...@@ -40,7 +38,7 @@ extern bool input_plugins_enabled[]; ...@@ -40,7 +38,7 @@ extern bool input_plugins_enabled[];
input_plugins_for_each(plugin) \ input_plugins_for_each(plugin) \
if (input_plugins_enabled[input_plugin_iterator - input_plugins]) if (input_plugins_enabled[input_plugin_iterator - input_plugins])
gcc_pure [[gnu::pure]]
bool bool
HasRemoteTagScanner(const char *uri) noexcept; HasRemoteTagScanner(const char *uri) noexcept;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_INPUT_CACHE_MANAGER_HXX #define MPD_INPUT_CACHE_MANAGER_HXX
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include <boost/intrusive/set.hpp> #include <boost/intrusive/set.hpp>
#include <boost/intrusive/list.hpp> #include <boost/intrusive/list.hpp>
...@@ -43,15 +42,15 @@ class InputCacheManager { ...@@ -43,15 +42,15 @@ class InputCacheManager {
size_t total_size = 0; size_t total_size = 0;
struct ItemCompare { struct ItemCompare {
gcc_pure [[gnu::pure]]
bool operator()(const InputCacheItem &a, bool operator()(const InputCacheItem &a,
const char *b) const noexcept; const char *b) const noexcept;
gcc_pure [[gnu::pure]]
bool operator()(const char *a, bool operator()(const char *a,
const InputCacheItem &b) const noexcept; const InputCacheItem &b) const noexcept;
gcc_pure [[gnu::pure]]
bool operator()(const InputCacheItem &a, bool operator()(const InputCacheItem &a,
const InputCacheItem &b) const noexcept; const InputCacheItem &b) const noexcept;
}; };
...@@ -74,7 +73,7 @@ public: ...@@ -74,7 +73,7 @@ public:
void Flush() noexcept; void Flush() noexcept;
gcc_pure [[gnu::pure]]
bool Contains(const char *uri) noexcept; bool Contains(const char *uri) noexcept;
/** /**
......
...@@ -55,7 +55,7 @@ public: ...@@ -55,7 +55,7 @@ public:
offset_type offset) override; offset_type offset) override;
}; };
gcc_const [[gnu::const]]
static inline bool static inline bool
input_ffmpeg_supported() noexcept input_ffmpeg_supported() noexcept
{ {
......
...@@ -77,7 +77,7 @@ public: ...@@ -77,7 +77,7 @@ public:
return format_id; return format_id;
} }
gcc_pure [[gnu::pure]]
CurlGlobal &GetCurl() noexcept; CurlGlobal &GetCurl() noexcept;
void AddLoginHandler(QobuzSessionHandler &h) noexcept; void AddLoginHandler(QobuzSessionHandler &h) noexcept;
......
...@@ -166,7 +166,7 @@ FinishQobuzInput() noexcept ...@@ -166,7 +166,7 @@ FinishQobuzInput() noexcept
delete qobuz_client; delete qobuz_client;
} }
gcc_pure [[gnu::pure]]
static const char * static const char *
ExtractQobuzTrackId(const char *uri) ExtractQobuzTrackId(const char *uri)
{ {
......
...@@ -48,10 +48,10 @@ class File : public LocalObject { ...@@ -48,10 +48,10 @@ class File : public LocalObject {
public: public:
using LocalObject::LocalObject; using LocalObject::LocalObject;
gcc_nonnull_all [[gnu::nonnull]]
static void Initialise(JNIEnv *env) noexcept; static void Initialise(JNIEnv *env) noexcept;
gcc_nonnull_all [[gnu::nonnull]]
static jstring GetAbsolutePath(JNIEnv *env, jobject file) noexcept { static jstring GetAbsolutePath(JNIEnv *env, jobject file) noexcept {
return (jstring)env->CallObjectMethod(file, return (jstring)env->CallObjectMethod(file,
getAbsolutePath_method); getAbsolutePath_method);
...@@ -69,7 +69,7 @@ public: ...@@ -69,7 +69,7 @@ public:
* Invoke File.getAbsolutePath() and release the * Invoke File.getAbsolutePath() and release the
* specified File reference. * specified File reference.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static AllocatedPath ToAbsolutePath(JNIEnv *env, static AllocatedPath ToAbsolutePath(JNIEnv *env,
jobject file) noexcept; jobject file) noexcept;
}; };
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#ifndef JAVA_GLOBAL_HXX #ifndef JAVA_GLOBAL_HXX
#define JAVA_GLOBAL_HXX #define JAVA_GLOBAL_HXX
#include "util/Compiler.h"
#include <jni.h> #include <jni.h>
namespace Java { namespace Java {
...@@ -47,8 +45,9 @@ DetachCurrentThread() noexcept ...@@ -47,8 +45,9 @@ DetachCurrentThread() noexcept
jvm->DetachCurrentThread(); jvm->DetachCurrentThread();
} }
static inline gcc_pure [[gnu::pure]]
JNIEnv *GetEnv() noexcept static inline JNIEnv *
GetEnv() noexcept
{ {
JNIEnv *env; JNIEnv *env;
jvm->AttachCurrentThread(&env, nullptr); jvm->AttachCurrentThread(&env, nullptr);
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
* enum. Returns SND_PCM_FORMAT_UNKNOWN if there is no according ALSA * enum. Returns SND_PCM_FORMAT_UNKNOWN if there is no according ALSA
* PCM format. * PCM format.
*/ */
gcc_const [[gnu::const]]
inline snd_pcm_format_t inline snd_pcm_format_t
ToAlsaPcmFormat(SampleFormat sample_format) noexcept ToAlsaPcmFormat(SampleFormat sample_format) noexcept
{ {
...@@ -82,7 +82,7 @@ ToAlsaPcmFormat(SampleFormat sample_format) noexcept ...@@ -82,7 +82,7 @@ ToAlsaPcmFormat(SampleFormat sample_format) noexcept
* Determine the byte-swapped PCM format. Returns * Determine the byte-swapped PCM format. Returns
* SND_PCM_FORMAT_UNKNOWN if the format cannot be byte-swapped. * SND_PCM_FORMAT_UNKNOWN if the format cannot be byte-swapped.
*/ */
gcc_const [[gnu::const]]
inline snd_pcm_format_t inline snd_pcm_format_t
ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt) noexcept ByteSwapAlsaPcmFormat(snd_pcm_format_t fmt) noexcept
{ {
...@@ -123,8 +123,7 @@ 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. * Check if there is a "packed" version of the give PCM format.
* Returns SND_PCM_FORMAT_UNKNOWN if not. * Returns SND_PCM_FORMAT_UNKNOWN if not.
*/ */
gcc_const constexpr snd_pcm_format_t
inline snd_pcm_format_t
PackAlsaPcmFormat(snd_pcm_format_t fmt) noexcept PackAlsaPcmFormat(snd_pcm_format_t fmt) noexcept
{ {
switch (fmt) { switch (fmt) {
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
gcc_pure [[gnu::pure]]
static uint_least32_t static uint_least32_t
ParseAlsaVersion(const char *p) noexcept ParseAlsaVersion(const char *p) noexcept
{ {
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_ALSA_VERSION_HXX #ifndef MPD_ALSA_VERSION_HXX
#define MPD_ALSA_VERSION_HXX #define MPD_ALSA_VERSION_HXX
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
static constexpr uint_least32_t static constexpr uint_least32_t
...@@ -35,7 +33,7 @@ MakeAlsaVersion(uint_least32_t major, uint_least32_t minor, ...@@ -35,7 +33,7 @@ MakeAlsaVersion(uint_least32_t major, uint_least32_t minor,
* Wrapper for snd_asoundlib_version() which translates the resulting * Wrapper for snd_asoundlib_version() which translates the resulting
* string to an integer constructed with MakeAlsaVersion(). * string to an integer constructed with MakeAlsaVersion().
*/ */
gcc_const [[gnu::const]]
uint_least32_t uint_least32_t
GetRuntimeAlsaVersion() noexcept; GetRuntimeAlsaVersion() noexcept;
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#define CDIO_PARANOIA_HXX #define CDIO_PARANOIA_HXX
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
#include "util/Compiler.h"
#include <cdio/version.h> #include <cdio/version.h>
#include <cdio/paranoia/paranoia.h> #include <cdio/paranoia/paranoia.h>
...@@ -88,7 +87,7 @@ public: ...@@ -88,7 +87,7 @@ public:
return std::pair(first, last); return std::pair(first, last);
} }
gcc_pure [[gnu::pure]]
bool IsAudioTrack(track_t i) const noexcept { bool IsAudioTrack(track_t i) const noexcept {
return cdio_cddap_track_audiop(drv, i); return cdio_cddap_track_audiop(drv, i);
} }
...@@ -101,7 +100,7 @@ public: ...@@ -101,7 +100,7 @@ public:
return std::pair(first, last); return std::pair(first, last);
} }
gcc_pure [[gnu::pure]]
unsigned GetTrackCount() const noexcept { unsigned GetTrackCount() const noexcept {
return cdio_cddap_tracks(drv); return cdio_cddap_tracks(drv);
} }
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#define MD5_HXX #define MD5_HXX
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
#include "util/Compiler.h"
#include <array> #include <array>
#include <cstdint> #include <cstdint>
...@@ -41,11 +40,11 @@ template<typename T> struct ConstBuffer; ...@@ -41,11 +40,11 @@ template<typename T> struct ConstBuffer;
void void
GlobalInitMD5() noexcept; GlobalInitMD5() noexcept;
gcc_pure [[gnu::pure]]
std::array<uint8_t, 16> std::array<uint8_t, 16>
MD5(ConstBuffer<void> input) noexcept; MD5(ConstBuffer<void> input) noexcept;
gcc_pure [[gnu::pure]]
StringBuffer<33> StringBuffer<33>
MD5Hex(ConstBuffer<void> input) noexcept; MD5Hex(ConstBuffer<void> input) noexcept;
......
/* /*
* 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 * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#define CURL_EASY_HXX #define CURL_EASY_HXX
#include "String.hxx" #include "String.hxx"
#include "util/Compiler.h"
#include <curl/curl.h> #include <curl/curl.h>
...@@ -199,7 +198,7 @@ public: ...@@ -199,7 +198,7 @@ public:
/** /**
* Returns the response body's size, or -1 if that is unknown. * Returns the response body's size, or -1 if that is unknown.
*/ */
gcc_pure [[gnu::pure]]
int64_t GetContentLength() const noexcept { int64_t GetContentLength() const noexcept {
double value; double value;
return GetInfo(CURLINFO_CONTENT_LENGTH_DOWNLOAD, &value) return GetInfo(CURLINFO_CONTENT_LENGTH_DOWNLOAD, &value)
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "Request.hxx" #include "Request.hxx"
#include "event/Loop.hxx" #include "event/Loop.hxx"
#include "event/SocketEvent.hxx" #include "event/SocketEvent.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
...@@ -84,7 +85,7 @@ private: ...@@ -84,7 +85,7 @@ private:
(flags & SocketEvent::ERROR ? CURL_CSELECT_ERR : 0); (flags & SocketEvent::ERROR ? CURL_CSELECT_ERR : 0);
} }
gcc_const [[gnu::const]]
static unsigned CurlPollToFlags(int action) noexcept { static unsigned CurlPollToFlags(int action) noexcept {
switch (action) { switch (action) {
case CURL_POLL_NONE: case CURL_POLL_NONE:
...@@ -172,7 +173,7 @@ CurlGlobal::Remove(CurlRequest &r) noexcept ...@@ -172,7 +173,7 @@ CurlGlobal::Remove(CurlRequest &r) noexcept
/** /**
* Find a request by its CURL "easy" handle. * Find a request by its CURL "easy" handle.
*/ */
gcc_pure [[gnu::pure]]
static CurlRequest * static CurlRequest *
ToRequest(CURL *easy) noexcept ToRequest(CURL *easy) noexcept
{ {
......
...@@ -172,7 +172,7 @@ CurlRequest::Done(CURLcode result) noexcept ...@@ -172,7 +172,7 @@ CurlRequest::Done(CURLcode result) noexcept
} }
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsResponseBoundaryHeader(StringView s) noexcept IsResponseBoundaryHeader(StringView s) noexcept
{ {
......
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
#ifndef CURL_VERSION_HXX #ifndef CURL_VERSION_HXX
#define CURL_VERSION_HXX #define CURL_VERSION_HXX
#include "util/Compiler.h" [[gnu::const]]
gcc_const
bool bool
IsCurlOlderThan(unsigned version_num) noexcept; IsCurlOlderThan(unsigned version_num) noexcept;
......
...@@ -33,8 +33,6 @@ ...@@ -33,8 +33,6 @@
#ifndef ODBUS_ERROR_HXX #ifndef ODBUS_ERROR_HXX
#define ODBUS_ERROR_HXX #define ODBUS_ERROR_HXX
#include "util/Compiler.h"
#include <dbus/dbus.h> #include <dbus/dbus.h>
namespace ODBus { namespace ODBus {
...@@ -54,7 +52,7 @@ public: ...@@ -54,7 +52,7 @@ public:
Error(const Error &) = delete; Error(const Error &) = delete;
Error &operator=(const Error &) = delete; Error &operator=(const Error &) = delete;
gcc_pure [[gnu::pure]]
operator bool() const noexcept { operator bool() const noexcept {
return dbus_error_is_set(&error); return dbus_error_is_set(&error);
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_EXPAT_HXX #ifndef MPD_EXPAT_HXX
#define MPD_EXPAT_HXX #define MPD_EXPAT_HXX
#include "util/Compiler.h"
#include <expat.h> #include <expat.h>
#include <stdexcept> #include <stdexcept>
...@@ -80,11 +78,11 @@ public: ...@@ -80,11 +78,11 @@ public:
void Parse(InputStream &is); void Parse(InputStream &is);
gcc_pure [[gnu::pure]]
static const char *GetAttribute(const XML_Char **atts, static const char *GetAttribute(const XML_Char **atts,
const char *name) noexcept; const char *name) noexcept;
gcc_pure [[gnu::pure]]
static const char *GetAttributeCase(const XML_Char **atts, static const char *GetAttributeCase(const XML_Char **atts,
const char *name) noexcept; const char *name) noexcept;
}; };
...@@ -117,13 +115,13 @@ public: ...@@ -117,13 +115,13 @@ public:
parser.CompleteParse(); parser.CompleteParse();
} }
gcc_pure [[gnu::pure]]
static const char *GetAttribute(const XML_Char **atts, static const char *GetAttribute(const XML_Char **atts,
const char *name) noexcept { const char *name) noexcept {
return ExpatParser::GetAttribute(atts, name); return ExpatParser::GetAttribute(atts, name);
} }
gcc_pure [[gnu::pure]]
static const char *GetAttributeCase(const XML_Char **atts, static const char *GetAttributeCase(const XML_Char **atts,
const char *name) noexcept { const char *name) noexcept {
return ExpatParser::GetAttributeCase(atts, name); return ExpatParser::GetAttributeCase(atts, name);
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_FFMPEG_BUFFER_HXX #ifndef MPD_FFMPEG_BUFFER_HXX
#define MPD_FFMPEG_BUFFER_HXX #define MPD_FFMPEG_BUFFER_HXX
#include "util/Compiler.h"
extern "C" { extern "C" {
#include <libavutil/mem.h> #include <libavutil/mem.h>
} }
...@@ -42,7 +40,7 @@ public: ...@@ -42,7 +40,7 @@ public:
FfmpegBuffer(const FfmpegBuffer &) = delete; FfmpegBuffer(const FfmpegBuffer &) = delete;
FfmpegBuffer &operator=(const FfmpegBuffer &) = delete; FfmpegBuffer &operator=(const FfmpegBuffer &) = delete;
gcc_malloc [[gnu::malloc]]
void *Get(size_t min_size) noexcept { void *Get(size_t min_size) noexcept {
av_fast_malloc(&data, &size, min_size); av_fast_malloc(&data, &size, min_size);
return data; return data;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_FFMPEG_IO_CONTEXT_HXX #ifndef MPD_FFMPEG_IO_CONTEXT_HXX
#define MPD_FFMPEG_IO_CONTEXT_HXX #define MPD_FFMPEG_IO_CONTEXT_HXX
#include "util/Compiler.h"
#include "Error.hxx" #include "Error.hxx"
extern "C" { extern "C" {
...@@ -65,12 +64,12 @@ public: ...@@ -65,12 +64,12 @@ public:
return io_context; return io_context;
} }
gcc_pure [[gnu::pure]]
auto GetSize() const noexcept { auto GetSize() const noexcept {
return avio_size(io_context); return avio_size(io_context);
} }
gcc_pure [[gnu::pure]]
bool IsEOF() const noexcept { bool IsEOF() const noexcept {
return avio_feof(io_context) != 0; return avio_feof(io_context) != 0;
} }
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_FFMPEG_TIME_HXX #define MPD_FFMPEG_TIME_HXX
#include "Chrono.hxx" #include "Chrono.hxx"
#include "util/Compiler.h"
extern "C" { extern "C" {
#include <libavutil/avutil.h> #include <libavutil/avutil.h>
...@@ -41,7 +40,7 @@ static constexpr AVRational AV_TIME_BASE_Q{1, AV_TIME_BASE}; ...@@ -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). * Convert a FFmpeg time stamp to a floating point value (in seconds).
*/ */
gcc_const [[gnu::const]]
static inline FloatDuration static inline FloatDuration
FfmpegTimeToDouble(int64_t t, const AVRational time_base) noexcept FfmpegTimeToDouble(int64_t t, const AVRational time_base) noexcept
{ {
...@@ -64,7 +63,7 @@ RatioToAVRational() ...@@ -64,7 +63,7 @@ RatioToAVRational()
/** /**
* Convert a FFmpeg time stamp to a #SongTime. * Convert a FFmpeg time stamp to a #SongTime.
*/ */
gcc_const [[gnu::const]]
static inline SongTime static inline SongTime
FromFfmpegTime(int64_t t, const AVRational time_base) noexcept FromFfmpegTime(int64_t t, const AVRational time_base) noexcept
{ {
...@@ -77,7 +76,7 @@ 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. * Convert a FFmpeg time stamp to a #SignedSongTime.
*/ */
gcc_const [[gnu::const]]
static inline SignedSongTime static inline SignedSongTime
FromFfmpegTimeChecked(int64_t t, const AVRational time_base) noexcept FromFfmpegTimeChecked(int64_t t, const AVRational time_base) noexcept
{ {
...@@ -89,7 +88,7 @@ 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. * Convert a #SongTime to a FFmpeg time stamp with the given base.
*/ */
gcc_const [[gnu::const]]
static inline int64_t static inline int64_t
ToFfmpegTime(SongTime t, const AVRational time_base) noexcept ToFfmpegTime(SongTime t, const AVRational time_base) noexcept
{ {
...@@ -104,7 +103,7 @@ ToFfmpegTime(SongTime t, const AVRational time_base) noexcept ...@@ -104,7 +103,7 @@ ToFfmpegTime(SongTime t, const AVRational time_base) noexcept
constexpr int64_t constexpr int64_t
FfmpegTimestampFallback(int64_t t, int64_t fallback) FfmpegTimestampFallback(int64_t t, int64_t fallback)
{ {
return gcc_likely(t != int64_t(AV_NOPTS_VALUE)) return t != int64_t(AV_NOPTS_VALUE)
? t ? t
: fallback; : fallback;
} }
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#define GCRYPT_HASH_HXX #define GCRYPT_HASH_HXX
#include "util/ConstBuffer.hxx" #include "util/ConstBuffer.hxx"
#include "util/Compiler.h"
#include <gcrypt.h> #include <gcrypt.h>
...@@ -40,7 +39,7 @@ ...@@ -40,7 +39,7 @@
namespace Gcrypt { namespace Gcrypt {
template<int algo, size_t size> template<int algo, size_t size>
gcc_pure [[gnu::pure]]
auto auto
Hash(ConstBuffer<void> input) noexcept Hash(ConstBuffer<void> input) noexcept
{ {
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#define GCRYPT_MD5_HXX #define GCRYPT_MD5_HXX
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
#include "util/Compiler.h"
#include <array> #include <array>
#include <cstdint> #include <cstdint>
...@@ -40,7 +39,7 @@ template<typename T> struct ConstBuffer; ...@@ -40,7 +39,7 @@ template<typename T> struct ConstBuffer;
namespace Gcrypt { namespace Gcrypt {
gcc_pure [[gnu::pure]]
std::array<uint8_t, 16> std::array<uint8_t, 16>
MD5(ConstBuffer<void> input) noexcept; MD5(ConstBuffer<void> input) noexcept;
......
...@@ -76,7 +76,7 @@ IcuCollateFinish() noexcept ...@@ -76,7 +76,7 @@ IcuCollateFinish() noexcept
#endif #endif
gcc_pure [[gnu::pure]]
int int
IcuCollate(std::string_view a, std::string_view b) noexcept IcuCollate(std::string_view a, std::string_view b) noexcept
{ {
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_ICU_COLLATE_HXX #ifndef MPD_ICU_COLLATE_HXX
#define MPD_ICU_COLLATE_HXX #define MPD_ICU_COLLATE_HXX
#include "util/Compiler.h"
#include <string_view> #include <string_view>
/** /**
...@@ -33,7 +31,7 @@ IcuCollateInit(); ...@@ -33,7 +31,7 @@ IcuCollateInit();
void void
IcuCollateFinish() noexcept; IcuCollateFinish() noexcept;
gcc_pure [[gnu::pure]]
int int
IcuCollate(std::string_view a, std::string_view b) noexcept; IcuCollate(std::string_view a, std::string_view b) noexcept;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_ICU_COMPARE_HXX #ifndef MPD_ICU_COMPARE_HXX
#define MPD_ICU_COMPARE_HXX #define MPD_ICU_COMPARE_HXX
#include "util/Compiler.h"
#include "util/AllocatedString.hxx" #include "util/AllocatedString.hxx"
#include <string_view> #include <string_view>
...@@ -63,15 +62,15 @@ public: ...@@ -63,15 +62,15 @@ public:
IcuCompare(IcuCompare &&) = default; IcuCompare(IcuCompare &&) = default;
IcuCompare &operator=(IcuCompare &&) = default; IcuCompare &operator=(IcuCompare &&) = default;
gcc_pure [[gnu::pure]]
operator bool() const noexcept { operator bool() const noexcept {
return needle != nullptr; return needle != nullptr;
} }
gcc_pure [[gnu::pure]]
bool operator==(const char *haystack) const noexcept; bool operator==(const char *haystack) const noexcept;
gcc_pure [[gnu::pure]]
bool IsIn(const char *haystack) const noexcept; bool IsIn(const char *haystack) const noexcept;
}; };
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_ICU_CONVERTER_HXX #ifndef MPD_ICU_CONVERTER_HXX
#define MPD_ICU_CONVERTER_HXX #define MPD_ICU_CONVERTER_HXX
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#ifdef HAVE_ICU #ifdef HAVE_ICU
...@@ -84,7 +83,6 @@ public: ...@@ -84,7 +83,6 @@ public:
* *
* Throws std::runtime_error on error. * Throws std::runtime_error on error.
*/ */
gcc_nonnull_all
AllocatedString ToUTF8(std::string_view s) const; AllocatedString ToUTF8(std::string_view s) const;
/** /**
...@@ -92,7 +90,6 @@ public: ...@@ -92,7 +90,6 @@ public:
* *
* Throws std::runtime_error on error. * Throws std::runtime_error on error.
*/ */
gcc_nonnull_all
AllocatedString FromUTF8(std::string_view s) const; AllocatedString FromUTF8(std::string_view s) const;
}; };
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_ICU_WIN32_HXX #ifndef MPD_ICU_WIN32_HXX
#define MPD_ICU_WIN32_HXX #define MPD_ICU_WIN32_HXX
#include "util/Compiler.h"
#include <string_view> #include <string_view>
class AllocatedString; class AllocatedString;
...@@ -30,14 +28,14 @@ template<typename T> class BasicAllocatedString; ...@@ -30,14 +28,14 @@ template<typename T> class BasicAllocatedString;
/** /**
* Throws std::system_error on error. * Throws std::system_error on error.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]]
AllocatedString AllocatedString
WideCharToMultiByte(unsigned code_page, std::wstring_view src); WideCharToMultiByte(unsigned code_page, std::wstring_view src);
/** /**
* Throws std::system_error on error. * Throws std::system_error on error.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]]
BasicAllocatedString<wchar_t> BasicAllocatedString<wchar_t>
MultiByteToWideChar(unsigned code_page, std::string_view src); MultiByteToWideChar(unsigned code_page, std::string_view src);
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_NFS_BASE_HXX #ifndef MPD_NFS_BASE_HXX
#define 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 * 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 * 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; ...@@ -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 * "path" after the export_name is returned; otherwise, nullptr is
* returned. * returned.
*/ */
gcc_pure [[gnu::pure]]
const char * const char *
nfs_check_base(const char *server, const char *path) noexcept; nfs_check_base(const char *server, const char *path) noexcept;
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_NFS_CANCELLABLE_HXX #ifndef MPD_NFS_CANCELLABLE_HXX
#define MPD_NFS_CANCELLABLE_HXX #define MPD_NFS_CANCELLABLE_HXX
#include "util/Compiler.h"
#include <boost/intrusive/list.hpp> #include <boost/intrusive/list.hpp>
#include <algorithm> #include <algorithm>
...@@ -89,35 +87,35 @@ private: ...@@ -89,35 +87,35 @@ private:
} }
}; };
gcc_pure [[gnu::pure]]
iterator Find(reference p) noexcept { iterator Find(reference p) noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p)); return std::find_if(list.begin(), list.end(), MatchPointer(p));
} }
gcc_pure [[gnu::pure]]
const_iterator Find(const_reference p) const noexcept { const_iterator Find(const_reference p) const noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p)); return std::find_if(list.begin(), list.end(), MatchPointer(p));
} }
gcc_pure [[gnu::pure]]
iterator Find(CT &c) noexcept { iterator Find(CT &c) noexcept {
return list.iterator_to(c); return list.iterator_to(c);
} }
gcc_pure [[gnu::pure]]
const_iterator Find(const CT &c) const noexcept { const_iterator Find(const CT &c) const noexcept {
return list.iterator_to(c); return list.iterator_to(c);
} }
public: public:
#ifndef NDEBUG #ifndef NDEBUG
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return std::all_of(list.begin(), list.end(), [](const auto &c) { return c.IsCancelled(); }); return std::all_of(list.begin(), list.end(), [](const auto &c) { return c.IsCancelled(); });
} }
#endif #endif
gcc_pure [[gnu::pure]]
bool Contains(const_reference p) const noexcept { bool Contains(const_reference p) const noexcept {
return Find(p) != list.end(); return Find(p) != list.end();
} }
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "event/SocketEvent.hxx" #include "event/SocketEvent.hxx"
#include "event/CoarseTimerEvent.hxx" #include "event/CoarseTimerEvent.hxx"
#include "event/DeferEvent.hxx" #include "event/DeferEvent.hxx"
#include "util/Compiler.h"
#include <string> #include <string>
#include <list> #include <list>
...@@ -139,7 +138,7 @@ class NfsConnection { ...@@ -139,7 +138,7 @@ class NfsConnection {
bool mount_finished; bool mount_finished;
public: public:
gcc_nonnull_all [[gnu::nonnull]]
NfsConnection(EventLoop &_loop, NfsConnection(EventLoop &_loop,
const char *_server, const char *_export_name) noexcept const char *_server, const char *_export_name) noexcept
:socket_event(_loop, BIND_THIS_METHOD(OnSocketReady)), :socket_event(_loop, BIND_THIS_METHOD(OnSocketReady)),
...@@ -157,12 +156,12 @@ public: ...@@ -157,12 +156,12 @@ public:
return socket_event.GetEventLoop(); return socket_event.GetEventLoop();
} }
gcc_pure [[gnu::pure]]
const char *GetServer() const noexcept { const char *GetServer() const noexcept {
return server.c_str(); return server.c_str();
} }
gcc_pure [[gnu::pure]]
const char *GetExportName() const noexcept { const char *GetExportName() const noexcept {
return export_name.c_str(); return export_name.c_str();
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_NFS_GLUE_HXX #ifndef MPD_NFS_GLUE_HXX
#define MPD_NFS_GLUE_HXX #define MPD_NFS_GLUE_HXX
#include "util/Compiler.h"
class EventLoop; class EventLoop;
class NfsConnection; class NfsConnection;
...@@ -34,11 +32,11 @@ nfs_finish() noexcept; ...@@ -34,11 +32,11 @@ nfs_finish() noexcept;
/** /**
* Return the EventLoop that was passed to nfs_init(). * Return the EventLoop that was passed to nfs_init().
*/ */
gcc_const [[gnu::const]]
EventLoop & EventLoop &
nfs_get_event_loop() noexcept; nfs_get_event_loop() noexcept;
gcc_pure [[gnu::pure]]
NfsConnection & NfsConnection &
nfs_get_connection(const char *server, const char *export_name) noexcept; nfs_get_connection(const char *server, const char *export_name) noexcept;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_NFS_MANAGER_HXX #define MPD_NFS_MANAGER_HXX
#include "Connection.hxx" #include "Connection.hxx"
#include "util/Compiler.h"
#include "event/IdleEvent.hxx" #include "event/IdleEvent.hxx"
#include <boost/intrusive/set.hpp> #include <boost/intrusive/set.hpp>
...@@ -56,15 +55,15 @@ class NfsManager final { ...@@ -56,15 +55,15 @@ class NfsManager final {
}; };
struct Compare { struct Compare {
gcc_pure [[gnu::pure]]
bool operator()(const LookupKey a, bool operator()(const LookupKey a,
const ManagedConnection &b) const noexcept; const ManagedConnection &b) const noexcept;
gcc_pure [[gnu::pure]]
bool operator()(const ManagedConnection &a, bool operator()(const ManagedConnection &a,
const LookupKey b) const noexcept; const LookupKey b) const noexcept;
gcc_pure [[gnu::pure]]
bool operator()(const ManagedConnection &a, bool operator()(const ManagedConnection &a,
const ManagedConnection &b) const noexcept; const ManagedConnection &b) const noexcept;
}; };
...@@ -102,7 +101,7 @@ public: ...@@ -102,7 +101,7 @@ public:
return idle_event.GetEventLoop(); return idle_event.GetEventLoop();
} }
gcc_pure [[gnu::pure]]
NfsConnection &GetConnection(const char *server, NfsConnection &GetConnection(const char *server,
const char *export_name) noexcept; const char *export_name) noexcept;
......
...@@ -59,7 +59,7 @@ public: ...@@ -59,7 +59,7 @@ public:
return re != nullptr; return re != nullptr;
} }
gcc_pure [[gnu::pure]]
bool Match(StringView s) const noexcept { bool Match(StringView s) const noexcept {
/* we don't need the data written to ovector, but PCRE can /* we don't need the data written to ovector, but PCRE can
omit internal allocations if we pass a buffer to omit internal allocations if we pass a buffer to
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define _UPNPDIR_HXX_INCLUDED_ #define _UPNPDIR_HXX_INCLUDED_
#include "Compat.hxx" #include "Compat.hxx"
#include "util/Compiler.h"
#include <string> #include <string>
#include <forward_list> #include <forward_list>
...@@ -112,7 +111,7 @@ public: ...@@ -112,7 +111,7 @@ public:
*/ */
std::forward_list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const; std::forward_list<std::string> getSearchCapabilities(UpnpClient_Handle handle) const;
gcc_pure [[gnu::pure]]
std::string GetURI() const noexcept { std::string GetURI() const noexcept {
return "upnp://" + m_deviceId + "/" + m_serviceType; return "upnp://" + m_deviceId + "/" + m_serviceType;
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_FLAC_METADATA_CHAIN_HXX #ifndef MPD_FLAC_METADATA_CHAIN_HXX
#define MPD_FLAC_METADATA_CHAIN_HXX #define MPD_FLAC_METADATA_CHAIN_HXX
#include "util/Compiler.h"
#include <FLAC/metadata.h> #include <FLAC/metadata.h>
class InputStream; class InputStream;
...@@ -67,12 +65,12 @@ public: ...@@ -67,12 +65,12 @@ public:
bool ReadOgg(InputStream &is) noexcept; bool ReadOgg(InputStream &is) noexcept;
gcc_pure [[gnu::pure]]
FLAC__Metadata_ChainStatus GetStatus() const noexcept { FLAC__Metadata_ChainStatus GetStatus() const noexcept {
return ::FLAC__metadata_chain_status(chain); return ::FLAC__metadata_chain_status(chain);
} }
gcc_pure [[gnu::pure]]
const char *GetStatusString() const noexcept { const char *GetStatusString() const noexcept {
return FLAC__Metadata_ChainStatusString[GetStatus()]; return FLAC__Metadata_ChainStatusString[GetStatus()];
} }
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_LS_HXX #ifndef MPD_LS_HXX
#define MPD_LS_HXX #define MPD_LS_HXX
#include "util/Compiler.h"
#include <stdio.h> #include <stdio.h>
class Response; class Response;
...@@ -31,7 +29,7 @@ class Response; ...@@ -31,7 +29,7 @@ class Response;
* It is not allowed to pass an URI without a scheme, check with * It is not allowed to pass an URI without a scheme, check with
* uri_has_scheme() first. * uri_has_scheme() first.
*/ */
gcc_pure [[gnu::pure]]
bool bool
uri_supported_scheme(const char *url) noexcept; uri_supported_scheme(const char *url) noexcept;
......
...@@ -20,15 +20,13 @@ ...@@ -20,15 +20,13 @@
#ifndef MPD_VOLUME_HXX #ifndef MPD_VOLUME_HXX
#define MPD_VOLUME_HXX #define MPD_VOLUME_HXX
#include "util/Compiler.h"
class MultipleOutputs; class MultipleOutputs;
class BufferedOutputStream; class BufferedOutputStream;
void void
InvalidateHardwareVolume() noexcept; InvalidateHardwareVolume() noexcept;
gcc_pure [[gnu::pure]]
int int
volume_level_get(const MultipleOutputs &outputs) noexcept; volume_level_get(const MultipleOutputs &outputs) noexcept;
...@@ -47,7 +45,7 @@ save_sw_volume_state(BufferedOutputStream &os); ...@@ -47,7 +45,7 @@ save_sw_volume_state(BufferedOutputStream &os);
* determine whether the state has changed and the state file should * determine whether the state has changed and the state file should
* be saved. * be saved.
*/ */
gcc_pure [[gnu::pure]]
unsigned unsigned
sw_volume_state_get_hash() noexcept; sw_volume_state_get_hash() noexcept;
......
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#ifndef MPD_NEIGHBOR_ALL_HXX #ifndef MPD_NEIGHBOR_ALL_HXX
#define MPD_NEIGHBOR_ALL_HXX #define MPD_NEIGHBOR_ALL_HXX
#include "util/Compiler.h"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include <forward_list> #include <forward_list>
...@@ -74,7 +73,7 @@ public: ...@@ -74,7 +73,7 @@ public:
* Get the combined list of all neighbors from all active * Get the combined list of all neighbors from all active
* plugins. * plugins.
*/ */
gcc_pure [[gnu::pure]]
List GetList() const noexcept; List GetList() const noexcept;
}; };
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_NEIGHBOR_REGISTRY_HXX #ifndef MPD_NEIGHBOR_REGISTRY_HXX
#define MPD_NEIGHBOR_REGISTRY_HXX #define MPD_NEIGHBOR_REGISTRY_HXX
#include "util/Compiler.h"
struct NeighborPlugin; struct NeighborPlugin;
/** /**
...@@ -30,7 +28,7 @@ struct NeighborPlugin; ...@@ -30,7 +28,7 @@ struct NeighborPlugin;
*/ */
extern const NeighborPlugin *const neighbor_plugins[]; extern const NeighborPlugin *const neighbor_plugins[];
gcc_pure [[gnu::pure]]
const NeighborPlugin * const NeighborPlugin *
GetNeighborPluginByName(const char *name) noexcept; GetNeighborPluginByName(const char *name) noexcept;
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#ifndef NET_TO_STRING_HXX #ifndef NET_TO_STRING_HXX
#define NET_TO_STRING_HXX #define NET_TO_STRING_HXX
#include "util/Compiler.h"
#include <string> #include <string>
class SocketAddress; class SocketAddress;
...@@ -40,7 +38,7 @@ class SocketAddress; ...@@ -40,7 +38,7 @@ class SocketAddress;
* Converts the specified socket address into a string in the form * Converts the specified socket address into a string in the form
* "IP:PORT". * "IP:PORT".
*/ */
gcc_pure [[gnu::pure]]
std::string std::string
ToString(SocketAddress address) noexcept; ToString(SocketAddress address) noexcept;
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "thread/Cond.hxx" #include "thread/Cond.hxx"
#include "system/PeriodClock.hxx" #include "system/PeriodClock.hxx"
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
#include <exception> #include <exception>
...@@ -266,20 +265,20 @@ public: ...@@ -266,20 +265,20 @@ public:
*/ */
void Configure(const ConfigBlock &block); void Configure(const ConfigBlock &block);
gcc_pure [[gnu::pure]]
const char *GetName() const noexcept; const char *GetName() const noexcept;
gcc_pure [[gnu::pure]]
const char *GetPluginName() const noexcept; const char *GetPluginName() const noexcept;
gcc_pure [[gnu::pure]]
const char *GetLogName() const noexcept; const char *GetLogName() const noexcept;
AudioOutputClient &GetClient() noexcept { AudioOutputClient &GetClient() noexcept {
return client; return client;
} }
gcc_pure [[gnu::pure]]
Mixer *GetMixer() const noexcept; Mixer *GetMixer() const noexcept;
bool IsDummy() const noexcept { bool IsDummy() const noexcept {
...@@ -451,10 +450,10 @@ public: ...@@ -451,10 +450,10 @@ public:
* *
* Caller must lock the mutex. * Caller must lock the mutex.
*/ */
gcc_pure [[gnu::pure]]
bool IsChunkConsumed(const MusicChunk &chunk) const noexcept; bool IsChunkConsumed(const MusicChunk &chunk) const noexcept;
gcc_pure [[gnu::pure]]
bool LockIsChunkConsumed(const MusicChunk &chunk) const noexcept; bool LockIsChunkConsumed(const MusicChunk &chunk) const noexcept;
/** /**
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define PCM_BUFFER_HXX #define PCM_BUFFER_HXX
#include "util/ReusableArray.hxx" #include "util/ReusableArray.hxx"
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
...@@ -47,11 +46,11 @@ public: ...@@ -47,11 +46,11 @@ public:
* to signal "error". An empty destination buffer is not * to signal "error". An empty destination buffer is not
* always an error. * always an error.
*/ */
gcc_malloc gcc_returns_nonnull [[gnu::malloc]] [[gnu::returns_nonnull]]
void *Get(size_t size) noexcept; void *Get(size_t size) noexcept;
template<typename T> template<typename T>
gcc_malloc gcc_returns_nonnull [[gnu::malloc]] [[gnu::returns_nonnull]]
T *GetT(size_t n) noexcept { T *GetT(size_t n) noexcept {
return (T *)Get(n * sizeof(T)); return (T *)Get(n * sizeof(T));
} }
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
* @param src the input buffer * @param src the input buffer
* @return the destination buffer * @return the destination buffer
*/ */
gcc_pure [[gnu::pure]]
ConstBuffer<void> Convert(ConstBuffer<void> src) noexcept; ConstBuffer<void> Convert(ConstBuffer<void> src) noexcept;
}; };
......
...@@ -159,13 +159,13 @@ public: ...@@ -159,13 +159,13 @@ public:
* DSD_U32, four input bytes (= 4 * 8 bits) are combined to * DSD_U32, four input bytes (= 4 * 8 bits) are combined to
* one output word (32 bits), dividing the sample rate by 4. * one output word (32 bits), dividing the sample rate by 4.
*/ */
gcc_pure [[gnu::pure]]
unsigned CalcOutputSampleRate(unsigned input_sample_rate) const noexcept; unsigned CalcOutputSampleRate(unsigned input_sample_rate) const noexcept;
/** /**
* The inverse of CalcOutputSampleRate(). * The inverse of CalcOutputSampleRate().
*/ */
gcc_pure [[gnu::pure]]
unsigned CalcInputSampleRate(unsigned output_sample_rate) const noexcept; unsigned CalcInputSampleRate(unsigned output_sample_rate) const noexcept;
}; };
...@@ -198,7 +198,7 @@ public: ...@@ -198,7 +198,7 @@ public:
/** /**
* Calculate the size of one input frame. * Calculate the size of one input frame.
*/ */
gcc_pure [[gnu::pure]]
size_t GetInputFrameSize() const noexcept { size_t GetInputFrameSize() const noexcept {
return channels * sample_format_size(src_sample_format); return channels * sample_format_size(src_sample_format);
} }
...@@ -206,19 +206,19 @@ public: ...@@ -206,19 +206,19 @@ public:
/** /**
* Calculate the size of one output frame. * Calculate the size of one output frame.
*/ */
gcc_pure [[gnu::pure]]
size_t GetOutputFrameSize() const noexcept; size_t GetOutputFrameSize() const noexcept;
/** /**
* @return the size of one input block in bytes * @return the size of one input block in bytes
*/ */
gcc_pure [[gnu::pure]]
size_t GetInputBlockSize() const noexcept; size_t GetInputBlockSize() const noexcept;
/** /**
* @return the size of one output block in bytes * @return the size of one output block in bytes
*/ */
gcc_pure [[gnu::pure]]
size_t GetOutputBlockSize() const noexcept; size_t GetOutputBlockSize() const noexcept;
/** /**
...@@ -243,7 +243,7 @@ public: ...@@ -243,7 +243,7 @@ public:
* destination buffer to the according number of bytes from the * destination buffer to the according number of bytes from the
* pcm_export() source buffer. * pcm_export() source buffer.
*/ */
gcc_pure [[gnu::pure]]
size_t CalcInputSize(size_t dest_size) const noexcept; size_t CalcInputSize(size_t dest_size) const noexcept;
}; };
......
...@@ -72,7 +72,7 @@ public: ...@@ -72,7 +72,7 @@ public:
* @param src the input buffer * @param src the input buffer
* @return the destination buffer * @return the destination buffer
*/ */
gcc_pure [[gnu::pure]]
ConstBuffer<void> Convert(ConstBuffer<void> src) noexcept; ConstBuffer<void> Convert(ConstBuffer<void> src) noexcept;
}; };
......
...@@ -37,7 +37,7 @@ class PcmDither; ...@@ -37,7 +37,7 @@ class PcmDither;
* @param src the source PCM buffer * @param src the source PCM buffer
* @return the destination buffer * @return the destination buffer
*/ */
gcc_pure [[gnu::pure]]
ConstBuffer<int16_t> ConstBuffer<int16_t>
pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither, pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither,
SampleFormat src_format, ConstBuffer<void> src) noexcept; SampleFormat src_format, ConstBuffer<void> src) noexcept;
...@@ -49,7 +49,7 @@ pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither, ...@@ -49,7 +49,7 @@ pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither,
* @param src the source PCM buffer * @param src the source PCM buffer
* @return the destination buffer * @return the destination buffer
*/ */
gcc_pure [[gnu::pure]]
ConstBuffer<int32_t> ConstBuffer<int32_t>
pcm_convert_to_24(PcmBuffer &buffer, pcm_convert_to_24(PcmBuffer &buffer,
SampleFormat src_format, ConstBuffer<void> src) noexcept; SampleFormat src_format, ConstBuffer<void> src) noexcept;
...@@ -61,7 +61,7 @@ pcm_convert_to_24(PcmBuffer &buffer, ...@@ -61,7 +61,7 @@ pcm_convert_to_24(PcmBuffer &buffer,
* @param src the source PCM buffer * @param src the source PCM buffer
* @return the destination buffer * @return the destination buffer
*/ */
gcc_pure [[gnu::pure]]
ConstBuffer<int32_t> ConstBuffer<int32_t>
pcm_convert_to_32(PcmBuffer &buffer, pcm_convert_to_32(PcmBuffer &buffer,
SampleFormat src_format, ConstBuffer<void> src) noexcept; SampleFormat src_format, ConstBuffer<void> src) noexcept;
...@@ -73,7 +73,7 @@ pcm_convert_to_32(PcmBuffer &buffer, ...@@ -73,7 +73,7 @@ pcm_convert_to_32(PcmBuffer &buffer,
* @param src the source PCM buffer * @param src the source PCM buffer
* @return the destination buffer * @return the destination buffer
*/ */
gcc_pure [[gnu::pure]]
ConstBuffer<float> ConstBuffer<float>
pcm_convert_to_float(PcmBuffer &buffer, pcm_convert_to_float(PcmBuffer &buffer,
SampleFormat src_format, ConstBuffer<void> src) noexcept; SampleFormat src_format, ConstBuffer<void> src) noexcept;
......
...@@ -120,7 +120,7 @@ public: ...@@ -120,7 +120,7 @@ public:
/** /**
* Apply the volume level. * Apply the volume level.
*/ */
gcc_pure [[gnu::pure]]
ConstBuffer<void> Apply(ConstBuffer<void> src) noexcept; ConstBuffer<void> Apply(ConstBuffer<void> src) noexcept;
}; };
......
...@@ -326,7 +326,7 @@ public: ...@@ -326,7 +326,7 @@ public:
*/ */
std::unique_ptr<DetachedSong> LockReadTaggedSong() noexcept; std::unique_ptr<DetachedSong> LockReadTaggedSong() noexcept;
gcc_pure [[gnu::pure]]
PlayerStatus LockGetStatus() noexcept; PlayerStatus LockGetStatus() noexcept;
PlayerState GetState() const noexcept { PlayerState GetState() const noexcept {
...@@ -338,7 +338,7 @@ public: ...@@ -338,7 +338,7 @@ public:
bool has_next_song; bool has_next_song;
}; };
gcc_pure [[gnu::pure]]
SyncInfo LockGetSyncInfo() const noexcept { SyncInfo LockGetSyncInfo() const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return {state, next_song != nullptr}; return {state, next_song != nullptr};
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_CROSSFADE_HXX #define MPD_CROSSFADE_HXX
#include "Chrono.hxx" #include "Chrono.hxx"
#include "util/Compiler.h"
struct AudioFormat; struct AudioFormat;
class SignedSongTime; class SignedSongTime;
...@@ -61,7 +60,7 @@ struct CrossFadeSettings { ...@@ -61,7 +60,7 @@ struct CrossFadeSettings {
* @return the number of chunks for crossfading, or 0 if cross fading * @return the number of chunks for crossfading, or 0 if cross fading
* should be disabled for this song change * should be disabled for this song change
*/ */
gcc_pure [[gnu::pure]]
unsigned Calculate(SignedSongTime total_time, unsigned Calculate(SignedSongTime total_time,
float replay_gain_db, float replay_gain_prev_db, float replay_gain_db, float replay_gain_prev_db,
const char *mixramp_start, const char *mixramp_start,
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "MusicChunkPtr.hxx" #include "MusicChunkPtr.hxx"
#include "Chrono.hxx" #include "Chrono.hxx"
#include "util/Compiler.h"
struct AudioFormat; struct AudioFormat;
struct MusicChunk; struct MusicChunk;
...@@ -107,7 +106,7 @@ public: ...@@ -107,7 +106,7 @@ public:
* chunk. A negative value is returned when no chunk has been * chunk. A negative value is returned when no chunk has been
* finished yet. * finished yet.
*/ */
gcc_pure [[gnu::pure]]
virtual SignedSongTime GetElapsedTime() const noexcept = 0; virtual SignedSongTime GetElapsedTime() const noexcept = 0;
}; };
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "input/Ptr.hxx" #include "input/Ptr.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include <string_view> #include <string_view>
...@@ -65,7 +64,7 @@ public: ...@@ -65,7 +64,7 @@ public:
* Shall this playlists supported by this plugin be represented as * Shall this playlists supported by this plugin be represented as
* directories in the database? * directories in the database?
*/ */
gcc_const [[gnu::const]]
bool bool
GetPlaylistPluginAsFolder(const PlaylistPlugin &plugin) noexcept; GetPlaylistPluginAsFolder(const PlaylistPlugin &plugin) noexcept;
...@@ -88,7 +87,7 @@ playlist_list_open_stream_suffix(InputStreamPtr &&is, std::string_view suffix); ...@@ -88,7 +87,7 @@ playlist_list_open_stream_suffix(InputStreamPtr &&is, std::string_view suffix);
std::unique_ptr<SongEnumerator> std::unique_ptr<SongEnumerator>
playlist_list_open_stream(InputStreamPtr &&is, const char *uri); playlist_list_open_stream(InputStreamPtr &&is, const char *uri);
gcc_pure [[gnu::pure]]
const PlaylistPlugin * const PlaylistPlugin *
FindPlaylistPluginBySuffix(std::string_view suffix) noexcept; FindPlaylistPluginBySuffix(std::string_view suffix) noexcept;
...@@ -96,7 +95,7 @@ FindPlaylistPluginBySuffix(std::string_view suffix) noexcept; ...@@ -96,7 +95,7 @@ FindPlaylistPluginBySuffix(std::string_view suffix) noexcept;
* Determines if there is a playlist plugin which can handle the * Determines if there is a playlist plugin which can handle the
* specified file name suffix. * specified file name suffix.
*/ */
gcc_pure [[gnu::pure]]
inline bool inline bool
playlist_suffix_supported(std::string_view suffix) noexcept playlist_suffix_supported(std::string_view suffix) noexcept
{ {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_AND_SONG_FILTER_HXX #define MPD_AND_SONG_FILTER_HXX
#include "ISongFilter.hxx" #include "ISongFilter.hxx"
#include "util/Compiler.h"
#include <list> #include <list>
...@@ -44,7 +43,7 @@ public: ...@@ -44,7 +43,7 @@ public:
items.emplace_back(std::forward<I>(_item)); items.emplace_back(std::forward<I>(_item));
} }
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return items.empty(); return items.empty();
} }
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "pcm/AudioFormat.hxx" #include "pcm/AudioFormat.hxx"
#include "Chrono.hxx" #include "Chrono.hxx"
#include "util/Compiler.h"
#include <chrono> #include <chrono>
#include <string> #include <string>
...@@ -108,7 +107,6 @@ public: ...@@ -108,7 +107,6 @@ public:
*/ */
explicit DetachedSong(const LightSong &other) noexcept; explicit DetachedSong(const LightSong &other) noexcept;
gcc_noinline
~DetachedSong() noexcept = default; ~DetachedSong() noexcept = default;
/* these are declared because the user-defined destructor /* these are declared because the user-defined destructor
...@@ -117,10 +115,10 @@ public: ...@@ -117,10 +115,10 @@ public:
DetachedSong(DetachedSong &&) = default; DetachedSong(DetachedSong &&) = default;
DetachedSong &operator=(DetachedSong &&) = default; DetachedSong &operator=(DetachedSong &&) = default;
gcc_pure [[gnu::pure]]
explicit operator LightSong() const noexcept; explicit operator LightSong() const noexcept;
gcc_pure [[gnu::pure]]
const char *GetURI() const noexcept { const char *GetURI() const noexcept {
return uri.c_str(); return uri.c_str();
} }
...@@ -134,7 +132,7 @@ public: ...@@ -134,7 +132,7 @@ public:
* Does this object have a "real" URI different from the * Does this object have a "real" URI different from the
* displayed URI? * displayed URI?
*/ */
gcc_pure [[gnu::pure]]
bool HasRealURI() const noexcept { bool HasRealURI() const noexcept {
return !real_uri.empty(); return !real_uri.empty();
} }
...@@ -143,7 +141,7 @@ public: ...@@ -143,7 +141,7 @@ public:
* Returns "real" URI (#real_uri) and falls back to just * Returns "real" URI (#real_uri) and falls back to just
* GetURI(). * GetURI().
*/ */
gcc_pure [[gnu::pure]]
const char *GetRealURI() const noexcept { const char *GetRealURI() const noexcept {
return (HasRealURI() ? real_uri : uri).c_str(); return (HasRealURI() ? real_uri : uri).c_str();
} }
...@@ -157,35 +155,35 @@ public: ...@@ -157,35 +155,35 @@ public:
* Returns true if both objects refer to the same physical * Returns true if both objects refer to the same physical
* song. * song.
*/ */
gcc_pure [[gnu::pure]]
bool IsSame(const DetachedSong &other) const noexcept { bool IsSame(const DetachedSong &other) const noexcept {
return uri == other.uri && return uri == other.uri &&
start_time == other.start_time && start_time == other.start_time &&
end_time == other.end_time; end_time == other.end_time;
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
bool IsURI(const char *other_uri) const noexcept { bool IsURI(const char *other_uri) const noexcept {
return uri == other_uri; return uri == other_uri;
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
bool IsRealURI(const char *other_uri) const noexcept { bool IsRealURI(const char *other_uri) const noexcept {
return (HasRealURI() ? real_uri : uri) == other_uri; return (HasRealURI() ? real_uri : uri) == other_uri;
} }
gcc_pure [[gnu::pure]]
bool IsRemote() const noexcept; bool IsRemote() const noexcept;
gcc_pure [[gnu::pure]]
bool IsFile() const noexcept { bool IsFile() const noexcept {
return !IsRemote(); return !IsRemote();
} }
gcc_pure [[gnu::pure]]
bool IsAbsoluteFile() const noexcept; bool IsAbsoluteFile() const noexcept;
gcc_pure [[gnu::pure]]
bool IsInDatabase() const noexcept; bool IsInDatabase() const noexcept;
const Tag &GetTag() const noexcept { const Tag &GetTag() const noexcept {
...@@ -240,7 +238,7 @@ public: ...@@ -240,7 +238,7 @@ public:
end_time = _value; end_time = _value;
} }
gcc_pure [[gnu::pure]]
SignedSongTime GetDuration() const noexcept; SignedSongTime GetDuration() const noexcept;
const AudioFormat &GetAudioFormat() const noexcept { const AudioFormat &GetAudioFormat() const noexcept {
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_SONG_FILTER_HXX #define MPD_SONG_FILTER_HXX
#include "AndSongFilter.hxx" #include "AndSongFilter.hxx"
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
#include <string> #include <string>
...@@ -42,7 +41,6 @@ class SongFilter { ...@@ -42,7 +41,6 @@ class SongFilter {
public: public:
SongFilter() = default; SongFilter() = default;
gcc_nonnull(3)
SongFilter(TagType tag, const char *value, bool fold_case=false); SongFilter(TagType tag, const char *value, bool fold_case=false);
~SongFilter(); ~SongFilter();
...@@ -59,7 +57,6 @@ public: ...@@ -59,7 +57,6 @@ public:
private: private:
static ISongFilterPtr ParseExpression(const char *&s, bool fold_case=false); static ISongFilterPtr ParseExpression(const char *&s, bool fold_case=false);
gcc_nonnull(2,3)
void Parse(const char *tag, const char *value, bool fold_case=false); void Parse(const char *tag, const char *value, bool fold_case=false);
public: public:
...@@ -70,14 +67,14 @@ public: ...@@ -70,14 +67,14 @@ public:
void Optimize() noexcept; void Optimize() noexcept;
gcc_pure [[gnu::pure]]
bool Match(const LightSong &song) const noexcept; bool Match(const LightSong &song) const noexcept;
const auto &GetItems() const noexcept { const auto &GetItems() const noexcept {
return and_filter.GetItems(); return and_filter.GetItems();
} }
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return and_filter.IsEmpty(); return and_filter.IsEmpty();
} }
...@@ -85,20 +82,20 @@ public: ...@@ -85,20 +82,20 @@ public:
/** /**
* Is there at least one item with "fold case" enabled? * Is there at least one item with "fold case" enabled?
*/ */
gcc_pure [[gnu::pure]]
bool HasFoldCase() const noexcept; bool HasFoldCase() const noexcept;
/** /**
* Does this filter contain constraints other than "base"? * Does this filter contain constraints other than "base"?
*/ */
gcc_pure [[gnu::pure]]
bool HasOtherThanBase() const noexcept; bool HasOtherThanBase() const noexcept;
/** /**
* Returns the "base" specification (if there is one) or * Returns the "base" specification (if there is one) or
* nullptr. * nullptr.
*/ */
gcc_pure [[gnu::pure]]
const char *GetBase() const noexcept; const char *GetBase() const noexcept;
/** /**
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_I_SONG_FILTER_HXX #ifndef MPD_I_SONG_FILTER_HXX
#define MPD_I_SONG_FILTER_HXX #define MPD_I_SONG_FILTER_HXX
#include "util/Compiler.h"
#include <memory> #include <memory>
#include <string> #include <string>
...@@ -41,7 +39,7 @@ public: ...@@ -41,7 +39,7 @@ public:
*/ */
virtual std::string ToExpression() const noexcept = 0; virtual std::string ToExpression() const noexcept = 0;
gcc_pure [[gnu::pure]]
virtual bool Match(const LightSong &song) const noexcept = 0; virtual bool Match(const LightSong &song) const noexcept = 0;
}; };
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "Chrono.hxx" #include "Chrono.hxx"
#include "pcm/AudioFormat.hxx" #include "pcm/AudioFormat.hxx"
#include "util/Compiler.h"
#include <string> #include <string>
#include <chrono> #include <chrono>
...@@ -101,7 +100,7 @@ struct LightSong { ...@@ -101,7 +100,7 @@ struct LightSong {
start_time(src.start_time), end_time(src.end_time), start_time(src.start_time), end_time(src.end_time),
audio_format(src.audio_format) {} audio_format(src.audio_format) {}
gcc_pure [[gnu::pure]]
std::string GetURI() const noexcept { std::string GetURI() const noexcept {
if (directory == nullptr) if (directory == nullptr)
return std::string(uri); return std::string(uri);
...@@ -112,7 +111,7 @@ struct LightSong { ...@@ -112,7 +111,7 @@ struct LightSong {
return result; return result;
} }
gcc_pure [[gnu::pure]]
SignedSongTime GetDuration() const noexcept; SignedSongTime GetDuration() const noexcept;
}; };
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_STRING_FILTER_HXX #define MPD_STRING_FILTER_HXX
#include "lib/icu/Compare.hxx" #include "lib/icu/Compare.hxx"
#include "util/Compiler.h"
#include "config.h" #include "config.h"
#ifdef HAVE_PCRE #ifdef HAVE_PCRE
...@@ -102,13 +101,13 @@ public: ...@@ -102,13 +101,13 @@ public:
: (negated ? "!=" : "==")); : (negated ? "!=" : "=="));
} }
gcc_pure [[gnu::pure]]
bool Match(const char *s) const noexcept; bool Match(const char *s) const noexcept;
/** /**
* Like Match(), but ignore the "negated" flag. * Like Match(), but ignore the "negated" flag.
*/ */
gcc_pure [[gnu::pure]]
bool MatchWithoutNegation(const char *s) const noexcept; bool MatchWithoutNegation(const char *s) const noexcept;
}; };
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "StorageInterface.hxx" #include "StorageInterface.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include <memory> #include <memory>
#include <string> #include <string>
...@@ -51,12 +50,12 @@ class CompositeStorage final : public Storage { ...@@ -51,12 +50,12 @@ class CompositeStorage final : public Storage {
std::map<std::string, Directory, std::less<>> children; std::map<std::string, Directory, std::less<>> children;
gcc_pure [[gnu::pure]]
bool IsEmpty() const noexcept { bool IsEmpty() const noexcept {
return storage == nullptr && children.empty(); return storage == nullptr && children.empty();
} }
gcc_pure [[gnu::pure]]
const Directory *Find(std::string_view uri) const noexcept; const Directory *Find(std::string_view uri) const noexcept;
Directory &Make(std::string_view uri); Directory &Make(std::string_view uri);
...@@ -64,7 +63,7 @@ class CompositeStorage final : public Storage { ...@@ -64,7 +63,7 @@ class CompositeStorage final : public Storage {
bool Unmount() noexcept; bool Unmount() noexcept;
bool Unmount(std::string_view uri) noexcept; bool Unmount(std::string_view uri) noexcept;
gcc_pure [[gnu::pure]]
bool MapToRelativeUTF8(std::string &buffer, bool MapToRelativeUTF8(std::string &buffer,
std::string_view uri) const noexcept; std::string_view uri) const noexcept;
}; };
...@@ -97,14 +96,14 @@ public: ...@@ -97,14 +96,14 @@ public:
* allowed to unmount the given mount point while the return * allowed to unmount the given mount point while the return
* value is being used. * value is being used.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]]
Storage *GetMount(std::string_view uri) noexcept; Storage *GetMount(std::string_view uri) noexcept;
/** /**
* Is the given URI a mount point, i.e. is something already * Is the given URI a mount point, i.e. is something already
* mounted on this path? * mounted on this path?
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
bool IsMountPoint(const char *uri) noexcept { bool IsMountPoint(const char *uri) noexcept {
return GetMount(uri) != nullptr; return GetMount(uri) != nullptr;
} }
...@@ -124,7 +123,7 @@ public: ...@@ -124,7 +123,7 @@ public:
/** /**
* Is a storage with the given URI already mounted? * Is a storage with the given URI already mounted?
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
bool IsMounted(const char *storage_uri) const noexcept { bool IsMounted(const char *storage_uri) const noexcept {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
return IsMounted(root, storage_uri); return IsMounted(root, storage_uri);
...@@ -164,7 +163,7 @@ private: ...@@ -164,7 +163,7 @@ private:
} }
} }
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
static bool IsMounted(const Directory &directory, static bool IsMounted(const Directory &directory,
const char *storage_uri) noexcept { const char *storage_uri) noexcept {
if (directory.storage) { if (directory.storage) {
...@@ -188,7 +187,7 @@ private: ...@@ -188,7 +187,7 @@ private:
* remaining unused part of the URI (may be empty if all of * remaining unused part of the URI (may be empty if all of
* the URI was used). * the URI was used).
*/ */
gcc_pure [[gnu::pure]]
FindResult FindStorage(std::string_view uri) const noexcept; FindResult FindStorage(std::string_view uri) const noexcept;
const char *MapToRelativeUTF8(const Directory &directory, const char *MapToRelativeUTF8(const Directory &directory,
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_STORAGE_CONFIG_HXX #ifndef MPD_STORAGE_CONFIG_HXX
#define MPD_STORAGE_CONFIG_HXX #define MPD_STORAGE_CONFIG_HXX
#include "util/Compiler.h"
#include <memory> #include <memory>
struct ConfigData; struct ConfigData;
...@@ -40,7 +38,7 @@ CreateConfiguredStorage(const ConfigData &config, EventLoop &event_loop); ...@@ -40,7 +38,7 @@ CreateConfiguredStorage(const ConfigData &config, EventLoop &event_loop);
/** /**
* Returns true if there is configuration for a #Storage instance. * Returns true if there is configuration for a #Storage instance.
*/ */
gcc_const [[gnu::const]]
bool bool
IsStorageConfigured(const ConfigData &config) noexcept; IsStorageConfigured(const ConfigData &config) noexcept;
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_STORAGE_INTERFACE_HXX #ifndef MPD_STORAGE_INTERFACE_HXX
#define MPD_STORAGE_INTERFACE_HXX #define MPD_STORAGE_INTERFACE_HXX
#include "util/Compiler.h"
#include <memory> #include <memory>
#include <string> #include <string>
#include <string_view> #include <string_view>
...@@ -62,7 +60,7 @@ public: ...@@ -62,7 +60,7 @@ public:
/** /**
* Map the given relative URI to an absolute URI. * Map the given relative URI to an absolute URI.
*/ */
gcc_pure [[gnu::pure]]
virtual std::string MapUTF8(std::string_view uri_utf8) const noexcept = 0; virtual std::string MapUTF8(std::string_view uri_utf8) const noexcept = 0;
/** /**
...@@ -70,10 +68,10 @@ public: ...@@ -70,10 +68,10 @@ public:
* nullptr on error or if this storage does not * nullptr on error or if this storage does not
* support local files. * support local files.
*/ */
gcc_pure [[gnu::pure]]
virtual AllocatedPath MapFS(std::string_view uri_utf8) const noexcept; virtual AllocatedPath MapFS(std::string_view uri_utf8) const noexcept;
gcc_pure [[gnu::pure]]
AllocatedPath MapChildFS(std::string_view uri_utf8, AllocatedPath MapChildFS(std::string_view uri_utf8,
std::string_view child_utf8) const noexcept; std::string_view child_utf8) const noexcept;
...@@ -82,7 +80,7 @@ public: ...@@ -82,7 +80,7 @@ public:
* then it returns a relative URI (pointing inside the given * then it returns a relative URI (pointing inside the given
* string); if not, returns nullptr. * string); if not, returns nullptr.
*/ */
gcc_pure [[gnu::pure]]
virtual std::string_view MapToRelativeUTF8(std::string_view uri_utf8) const noexcept = 0; virtual std::string_view MapToRelativeUTF8(std::string_view uri_utf8) const noexcept = 0;
}; };
......
...@@ -22,14 +22,12 @@ ...@@ -22,14 +22,12 @@
#ifdef _WIN32 #ifdef _WIN32
#include "util/Compiler.h"
#include <chrono> #include <chrono>
/** /**
* Returns the uptime of the current process in seconds. * Returns the uptime of the current process in seconds.
*/ */
gcc_pure [[gnu::pure]]
std::chrono::seconds std::chrono::seconds
GetProcessUptimeS(); GetProcessUptimeS();
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
static constexpr size_t ID3V1_SIZE = 128; static constexpr size_t ID3V1_SIZE = 128;
gcc_pure [[gnu::pure]]
static inline bool static inline bool
tag_is_id3v1(struct id3_tag *tag) noexcept tag_is_id3v1(struct id3_tag *tag) noexcept
{ {
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#ifndef THREAD_ID_HXX #ifndef THREAD_ID_HXX
#define THREAD_ID_HXX #define THREAD_ID_HXX
#include "util/Compiler.h"
#ifdef _WIN32 #ifdef _WIN32
#include <processthreadsapi.h> #include <processthreadsapi.h>
#else #else
...@@ -70,7 +68,7 @@ public: ...@@ -70,7 +68,7 @@ public:
#endif #endif
} }
gcc_pure [[gnu::pure]]
bool IsNull() const noexcept { bool IsNull() const noexcept {
return *this == Null(); return *this == Null();
} }
...@@ -78,7 +76,7 @@ public: ...@@ -78,7 +76,7 @@ public:
/** /**
* Return the current thread's id . * Return the current thread's id .
*/ */
gcc_pure [[gnu::pure]]
static const ThreadId GetCurrent() noexcept { static const ThreadId GetCurrent() noexcept {
#ifdef _WIN32 #ifdef _WIN32
return ::GetCurrentThreadId(); return ::GetCurrentThreadId();
...@@ -87,7 +85,7 @@ public: ...@@ -87,7 +85,7 @@ public:
#endif #endif
} }
gcc_pure [[gnu::pure]]
bool operator==(const ThreadId &other) const noexcept { bool operator==(const ThreadId &other) const noexcept {
/* note: not using pthread_equal() because that /* note: not using pthread_equal() because that
function "is undefined if either thread ID is not function "is undefined if either thread ID is not
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#define MPD_THREAD_HXX #define MPD_THREAD_HXX
#include "util/BindMethod.hxx" #include "util/BindMethod.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
...@@ -78,7 +77,7 @@ public: ...@@ -78,7 +77,7 @@ public:
/** /**
* Check if this thread is the current thread. * Check if this thread is the current thread.
*/ */
gcc_pure [[gnu::pure]]
bool IsInside() const noexcept { bool IsInside() const noexcept {
#ifdef _WIN32 #ifdef _WIN32
return GetCurrentThreadId() == id; return GetCurrentThreadId() == id;
......
...@@ -87,7 +87,7 @@ public: ...@@ -87,7 +87,7 @@ public:
} }
}; };
gcc_pure [[gnu::pure]]
static inline pid_t static inline pid_t
ReadPidFile(Path path) noexcept ReadPidFile(Path path) noexcept
{ {
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#ifndef MPD_BIT_REVERSE_HXX #ifndef MPD_BIT_REVERSE_HXX
#define MPD_BIT_REVERSE_HXX #define MPD_BIT_REVERSE_HXX
#include "Compiler.h"
#include <cstdint> #include <cstdint>
/** /**
...@@ -43,7 +41,7 @@ struct BitReverseTable { ...@@ -43,7 +41,7 @@ struct BitReverseTable {
extern const BitReverseTable bit_reverse_table; extern const BitReverseTable bit_reverse_table;
gcc_const [[gnu::const]]
static inline uint8_t static inline uint8_t
bit_reverse(uint8_t x) noexcept bit_reverse(uint8_t x) noexcept
{ {
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "ConstBuffer.hxx" #include "ConstBuffer.hxx"
#include "StringBuffer.hxx" #include "StringBuffer.hxx"
#include "Compiler.h"
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>
...@@ -53,7 +52,7 @@ HexFormat(char *dest, ConstBuffer<uint8_t> src) noexcept; ...@@ -53,7 +52,7 @@ HexFormat(char *dest, ConstBuffer<uint8_t> src) noexcept;
* required size. * required size.
*/ */
template<size_t size> template<size_t size>
gcc_pure [[gnu::pure]]
auto auto
HexFormatBuffer(const uint8_t *src) noexcept HexFormatBuffer(const uint8_t *src) noexcept
{ {
......
...@@ -46,7 +46,7 @@ IsValidSchemeChar(char ch) ...@@ -46,7 +46,7 @@ IsValidSchemeChar(char ch)
ch == '+' || ch == '.' || ch == '-'; ch == '+' || ch == '.' || ch == '-';
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsValidScheme(std::string_view p) noexcept IsValidScheme(std::string_view p) noexcept
{ {
...@@ -64,7 +64,7 @@ IsValidScheme(std::string_view p) noexcept ...@@ -64,7 +64,7 @@ IsValidScheme(std::string_view p) noexcept
* Return the URI part after the scheme specification (and after the * Return the URI part after the scheme specification (and after the
* double slash). * double slash).
*/ */
gcc_pure [[gnu::pure]]
static std::string_view static std::string_view
uri_after_scheme(std::string_view uri) noexcept uri_after_scheme(std::string_view uri) noexcept
{ {
...@@ -120,7 +120,7 @@ uri_get_path(std::string_view uri) noexcept ...@@ -120,7 +120,7 @@ uri_get_path(std::string_view uri) noexcept
return uri; return uri;
} }
gcc_pure [[gnu::pure]]
static StringView static StringView
UriWithoutQueryString(StringView uri) noexcept UriWithoutQueryString(StringView uri) noexcept
{ {
......
...@@ -30,26 +30,24 @@ ...@@ -30,26 +30,24 @@
#ifndef URI_EXTRACT_HXX #ifndef URI_EXTRACT_HXX
#define URI_EXTRACT_HXX #define URI_EXTRACT_HXX
#include "Compiler.h"
#include <string_view> #include <string_view>
/** /**
* Checks whether the specified URI has a scheme in the form * Checks whether the specified URI has a scheme in the form
* "scheme://". * "scheme://".
*/ */
gcc_pure [[gnu::pure]]
bool bool
uri_has_scheme(std::string_view uri) noexcept; uri_has_scheme(std::string_view uri) noexcept;
/** /**
* Returns the scheme name of the specified URI, or an empty string. * Returns the scheme name of the specified URI, or an empty string.
*/ */
gcc_pure [[gnu::pure]]
std::string_view std::string_view
uri_get_scheme(std::string_view uri) noexcept; uri_get_scheme(std::string_view uri) noexcept;
gcc_pure [[gnu::pure]]
bool bool
uri_is_relative_path(const char *uri) noexcept; uri_is_relative_path(const char *uri) noexcept;
...@@ -57,11 +55,11 @@ uri_is_relative_path(const char *uri) noexcept; ...@@ -57,11 +55,11 @@ uri_is_relative_path(const char *uri) noexcept;
* Returns the URI path (including the query string) or nullptr if the * Returns the URI path (including the query string) or nullptr if the
* given URI has no path. * given URI has no path.
*/ */
gcc_pure [[gnu::pure]]
std::string_view std::string_view
uri_get_path(std::string_view uri) noexcept; uri_get_path(std::string_view uri) noexcept;
gcc_pure [[gnu::pure]]
std::string_view std::string_view
uri_get_suffix(std::string_view uri) noexcept; uri_get_suffix(std::string_view uri) noexcept;
...@@ -71,7 +69,7 @@ uri_get_suffix(std::string_view uri) noexcept; ...@@ -71,7 +69,7 @@ uri_get_suffix(std::string_view uri) noexcept;
* nullptr; if there is a '#' but no fragment text, it returns an * nullptr; if there is a '#' but no fragment text, it returns an
* empty StringView. * empty StringView.
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]] [[gnu::nonnull]]
const char * const char *
uri_get_fragment(const char *uri) noexcept; uri_get_fragment(const char *uri) noexcept;
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#ifndef URI_UTIL_HXX #ifndef URI_UTIL_HXX
#define URI_UTIL_HXX #define URI_UTIL_HXX
#include "Compiler.h"
#include <string> #include <string>
/** /**
...@@ -42,7 +40,7 @@ ...@@ -42,7 +40,7 @@
* - no double slashes * - no double slashes
* - no path component begins with a dot * - no path component begins with a dot
*/ */
gcc_pure [[gnu::pure]]
bool bool
uri_safe_local(const char *uri) noexcept; uri_safe_local(const char *uri) noexcept;
...@@ -52,7 +50,7 @@ uri_safe_local(const char *uri) noexcept; ...@@ -52,7 +50,7 @@ uri_safe_local(const char *uri) noexcept;
* an empty string if nothing needs to be removed, or if the URI is * an empty string if nothing needs to be removed, or if the URI is
* not recognized. * not recognized.
*/ */
gcc_pure [[gnu::pure]]
std::string std::string
uri_remove_auth(const char *uri) noexcept; uri_remove_auth(const char *uri) noexcept;
...@@ -60,7 +58,7 @@ uri_remove_auth(const char *uri) noexcept; ...@@ -60,7 +58,7 @@ uri_remove_auth(const char *uri) noexcept;
* Remove dot segments in the URI. For example, uri_squash_dot_segments * Remove dot segments in the URI. For example, uri_squash_dot_segments
* ("foo/bar/.././")=="foo/". * ("foo/bar/.././")=="foo/".
*/ */
gcc_pure [[gnu::pure]]
std::string std::string
uri_squash_dot_segments(const char *uri) noexcept; uri_squash_dot_segments(const char *uri) noexcept;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment