use [[gnu::...]] attributes
This commit is contained in:
parent
3b9aab0684
commit
42f6a0441c
|
@ -17,7 +17,7 @@
|
|||
/**
|
||||
* Does the #DecoderPlugin support either the suffix or the MIME type?
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
CheckDecoderPlugin(const DecoderPlugin &plugin,
|
||||
std::string_view suffix, std::string_view mime) noexcept
|
||||
|
|
|
@ -204,7 +204,7 @@ static constexpr struct command commands[] = {
|
|||
|
||||
static constexpr unsigned num_commands = std::size(commands);
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
command_available([[maybe_unused]] const Partition &partition,
|
||||
[[maybe_unused]] const struct command *cmd) noexcept
|
||||
|
@ -290,7 +290,7 @@ command_init() noexcept
|
|||
#endif
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const struct command *
|
||||
command_lookup(const char *name) noexcept
|
||||
{
|
||||
|
|
|
@ -34,14 +34,14 @@
|
|||
#include <cassert>
|
||||
#include <array>
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
SkipNameFS(PathTraitsFS::const_pointer name_fs) noexcept
|
||||
{
|
||||
return PathTraitsFS::IsSpecialFilename(name_fs);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
skip_path(Path name_fs) noexcept
|
||||
{
|
||||
|
@ -87,7 +87,7 @@ handle_listfiles_local(Response &r, Path path_fs)
|
|||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsValidName(const std::string_view s) noexcept
|
||||
{
|
||||
|
@ -99,7 +99,7 @@ IsValidName(const std::string_view s) noexcept
|
|||
});
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsValidValue(const std::string_view s) noexcept
|
||||
{
|
||||
|
|
|
@ -101,7 +101,7 @@ GetChromaprintCommand::DecodeStream(InputStream &input_stream,
|
|||
plugin.StreamDecode(*this, input_stream);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
decoder_check_plugin_mime(const DecoderPlugin &plugin,
|
||||
const InputStream &is) noexcept
|
||||
|
@ -113,7 +113,7 @@ decoder_check_plugin_mime(const DecoderPlugin &plugin,
|
|||
plugin.SupportsMimeType(GetMimeTypeBase(mime_type));
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
decoder_check_plugin_suffix(const DecoderPlugin &plugin,
|
||||
std::string_view suffix) noexcept
|
||||
|
@ -123,7 +123,7 @@ decoder_check_plugin_suffix(const DecoderPlugin &plugin,
|
|||
return !suffix.empty() && plugin.SupportsSuffix(suffix);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is,
|
||||
std::string_view suffix) noexcept
|
||||
|
|
|
@ -71,7 +71,7 @@ IsValidAttributeNameChar(char ch) noexcept
|
|||
return IsAlphaNumericASCII(ch) || ch == '_';
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsValidAttributeName(const char *s) noexcept
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ IsValidPartitionChar(char ch)
|
|||
return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_';
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsValidPartitionName(const char *name) noexcept
|
||||
{
|
||||
|
@ -56,7 +56,7 @@ IsValidPartitionName(const char *name) noexcept
|
|||
return true;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
HasPartitionNamed(Instance &instance, const char *name) noexcept
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
skip_path(const char *name_utf8) noexcept
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ ConfigData::Clear()
|
|||
}
|
||||
|
||||
template<typename T>
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static auto
|
||||
FindLast(const std::forward_list<T> &list)
|
||||
{
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_CONFIG_PARAM_HXX
|
||||
#define MPD_CONFIG_PARAM_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
class AllocatedPath;
|
||||
|
|
|
@ -89,7 +89,7 @@ static constexpr unsigned n_config_block_templates =
|
|||
static_assert(n_config_block_templates == unsigned(ConfigBlockOption::MAX),
|
||||
"Wrong number of config_block_templates");
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static inline unsigned
|
||||
ParseConfigTemplateName(const ConfigTemplate templates[], unsigned count,
|
||||
const char *name) noexcept
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_DB_COUNT_HXX
|
||||
#define MPD_DB_COUNT_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
enum TagType : uint8_t;
|
||||
|
@ -13,7 +11,6 @@ struct Partition;
|
|||
class Response;
|
||||
class SongFilter;
|
||||
|
||||
gcc_nonnull(3)
|
||||
void
|
||||
PrintSongCount(Response &r, const Partition &partition, const char *name,
|
||||
const SongFilter *filter,
|
||||
|
|
|
@ -4,14 +4,11 @@
|
|||
#ifndef MPD_DATABASE_PLAYLIST_HXX
|
||||
#define MPD_DATABASE_PLAYLIST_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
class Database;
|
||||
class Storage;
|
||||
struct DatabaseSelection;
|
||||
class PlaylistFileEditor;
|
||||
|
||||
gcc_nonnull(3)
|
||||
void
|
||||
search_add_to_playlist(const Database &db, const Storage *storage,
|
||||
const char *playlist_path_utf8,
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include <functional>
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *
|
||||
ApplyBaseFlag(const char *uri, bool base) noexcept
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <string.h>
|
||||
|
||||
struct StringLess {
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool operator()(const char *a, const char *b) const noexcept {
|
||||
return strcmp(a, b) < 0;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include "song/UriSongFilter.hxx"
|
||||
#include "song/BaseSongFilter.hxx"
|
||||
#include "song/TagSongFilter.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "config/Block.hxx"
|
||||
#include "tag/Builder.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
|
@ -265,7 +264,7 @@ ProxySong::ProxySong(const mpd_song *song)
|
|||
tag_builder.Commit(tag2);
|
||||
}
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static enum mpd_tag_type
|
||||
Convert(TagType tag_type) noexcept
|
||||
{
|
||||
|
@ -694,7 +693,7 @@ Visit(struct mpd_connection *connection,
|
|||
visit_directory, visit_song, visit_playlist);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
Match(const SongFilter *filter, const LightSong &song) noexcept
|
||||
{
|
||||
|
@ -864,7 +863,7 @@ try {
|
|||
throw;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsFilterSupported(const ISongFilter &f) noexcept
|
||||
{
|
||||
|
@ -890,7 +889,7 @@ IsFilterSupported(const ISongFilter &f) noexcept
|
|||
return false;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsFilterFullySupported(const SongFilter &filter,
|
||||
const struct mpd_connection *connection) noexcept
|
||||
|
@ -908,7 +907,7 @@ IsFilterFullySupported(const SongFilter &filter,
|
|||
[](const auto &item) { return IsFilterSupported(*item); });
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsFilterFullySupported(const SongFilter *filter,
|
||||
const struct mpd_connection *connection) noexcept
|
||||
|
@ -917,7 +916,7 @@ IsFilterFullySupported(const SongFilter *filter,
|
|||
IsFilterFullySupported(*filter, connection);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsSortSupported(TagType tag_type,
|
||||
const struct mpd_connection *connection) noexcept
|
||||
|
@ -939,7 +938,7 @@ IsSortSupported(TagType tag_type,
|
|||
return Convert(tag_type) != MPD_TAG_COUNT;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static DatabaseSelection
|
||||
CheckSelection(DatabaseSelection selection,
|
||||
struct mpd_connection *connection) noexcept
|
||||
|
|
|
@ -193,7 +193,7 @@ Directory::FindSong(std::string_view name_utf8) const noexcept
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
directory_cmp(const Directory &a, const Directory &b) noexcept
|
||||
{
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define DIRECTORY_BEGIN "begin: "
|
||||
#define DIRECTORY_END "end: "
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static const char *
|
||||
DeviceToTypeString(unsigned device) noexcept
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ DeviceToTypeString(unsigned device) noexcept
|
|||
}
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static unsigned
|
||||
ParseTypeString(const char *type) noexcept
|
||||
{
|
||||
|
|
|
@ -248,7 +248,7 @@ SimpleDatabase::ReturnSong([[maybe_unused]] const LightSong *song) const noexcep
|
|||
}
|
||||
}
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static DatabaseSelection
|
||||
CheckSelection(DatabaseSelection selection) noexcept
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@ Song::GetURI() const noexcept
|
|||
/**
|
||||
* Path name traversal of a #Directory.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const Directory *
|
||||
FindTargetDirectory(const Directory &base, std::string_view path) noexcept
|
||||
{
|
||||
|
@ -69,7 +69,7 @@ FindTargetDirectory(const Directory &base, std::string_view path) noexcept
|
|||
/**
|
||||
* Path name traversal of a #Song.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const Song *
|
||||
FindTargetSong(const Directory &_directory, std::string_view target) noexcept
|
||||
{
|
||||
|
|
|
@ -60,7 +60,7 @@ compare_tag_item(const Tag &a, const Tag &b, TagType type) noexcept
|
|||
}
|
||||
|
||||
/* Only used for sorting/searchin a songvec, not general purpose compares */
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
song_cmp(const Song &a, const Song &b) noexcept
|
||||
{
|
||||
|
|
|
@ -563,7 +563,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
|
|||
}
|
||||
}
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static DatabaseSelection
|
||||
CheckSelection(DatabaseSelection selection) noexcept
|
||||
{
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "fs/FileInfo.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <cassert>
|
||||
|
@ -61,10 +60,10 @@ struct WatchDirectory {
|
|||
|
||||
void LoadExcludeList(Path directory_path) noexcept;
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
unsigned GetDepth() const noexcept;
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
AllocatedPath GetUriFS() const noexcept;
|
||||
};
|
||||
|
||||
|
@ -137,7 +136,7 @@ WatchDirectory::GetUriFS() const noexcept
|
|||
}
|
||||
|
||||
/* we don't look at "." / ".." nor files with newlines in their name */
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
SkipFilename(Path name) noexcept
|
||||
{
|
||||
|
@ -210,7 +209,7 @@ try {
|
|||
LogError(std::current_exception());
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned
|
||||
WatchDirectory::GetDepth() const noexcept
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "playlist/PlaylistRegistry.hxx"
|
||||
#include "fs/Traits.hxx"
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
HaveArchivePluginForFilename(const char *filename) noexcept
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ HaveArchivePluginForFilename(const char *filename) noexcept
|
|||
#endif
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
HaveContainerPluginForFilename(const char *filename) noexcept
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ HaveContainerPluginForFilename(const char *filename) noexcept
|
|||
decoder_plugins_supports_suffix(suffix);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
HavePlaylistPluginForFilename(const char *filename) noexcept
|
||||
{
|
||||
|
|
|
@ -215,14 +215,14 @@ try {
|
|||
}
|
||||
|
||||
/* we don't look at files with newlines in their name */
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
skip_path(const char *name_utf8) noexcept
|
||||
{
|
||||
return std::strchr(name_utf8, '\n') != nullptr;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
UpdateWalk::SkipSymlink(const Directory *directory,
|
||||
std::string_view utf8_name) const noexcept
|
||||
|
|
|
@ -148,7 +148,7 @@ decoder_file_decode(const DecoderPlugin &plugin,
|
|||
return bridge.dc.state != DecoderState::START;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
decoder_check_plugin_mime(const DecoderPlugin &plugin,
|
||||
const InputStream &is) noexcept
|
||||
|
@ -160,7 +160,7 @@ decoder_check_plugin_mime(const DecoderPlugin &plugin,
|
|||
plugin.SupportsMimeType(GetMimeTypeBase(mime_type));
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
decoder_check_plugin_suffix(const DecoderPlugin &plugin,
|
||||
std::string_view suffix) noexcept
|
||||
|
@ -170,7 +170,7 @@ decoder_check_plugin_suffix(const DecoderPlugin &plugin,
|
|||
return !suffix.empty() && plugin.SupportsSuffix(suffix);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is,
|
||||
std::string_view suffix) noexcept
|
||||
|
@ -449,7 +449,7 @@ try {
|
|||
* are only kept as a cache to be displayed by the client; they shall
|
||||
* not be sent to the output.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
SongHasVolatileTags(const DetachedSong &song) noexcept
|
||||
{
|
||||
|
|
|
@ -48,7 +48,7 @@ struct AudioFileInputStream {
|
|||
}
|
||||
};
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static SongTime
|
||||
audiofile_get_duration(AFfilehandle fh) noexcept
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ setup_virtual_fops(AudioFileInputStream &afis) noexcept
|
|||
return vf;
|
||||
}
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static SampleFormat
|
||||
audiofile_bits_to_sample_format(int bits) noexcept
|
||||
{
|
||||
|
|
|
@ -88,14 +88,14 @@ ffmpeg_finish() noexcept
|
|||
av_dict_free(&avformat_options);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsAudio(const AVStream &stream) noexcept
|
||||
{
|
||||
return stream.codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static int
|
||||
ffmpeg_find_audio_stream(const AVFormatContext &format_context) noexcept
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ ffmpeg_find_audio_stream(const AVFormatContext &format_context) noexcept
|
|||
return -1;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsPicture(const AVStream &stream) noexcept
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ start_time_fallback(const AVStream &stream)
|
|||
* Convert AVPacket::pts to a stream-relative time stamp (still in
|
||||
* AVStream::time_base units). Returns a negative value on error.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static int64_t
|
||||
StreamRelativePts(const AVPacket &packet, const AVStream &stream) noexcept
|
||||
{
|
||||
|
@ -181,7 +181,7 @@ StreamRelativePts(const AVPacket &packet, const AVStream &stream) noexcept
|
|||
* Convert a non-negative stream-relative time stamp in
|
||||
* AVStream::time_base units to a PCM frame number.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static uint64_t
|
||||
PtsToPcmFrame(uint64_t pts, const AVStream &stream,
|
||||
const AVCodecContext &codec_context) noexcept
|
||||
|
@ -323,7 +323,7 @@ ffmpeg_send_packet(DecoderClient &client, InputStream *is,
|
|||
return cmd;
|
||||
}
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static SampleFormat
|
||||
ffmpeg_sample_format(enum AVSampleFormat sample_fmt) noexcept
|
||||
{
|
||||
|
|
|
@ -61,7 +61,7 @@ gme_plugin_init([[maybe_unused]] const ConfigBlock &block)
|
|||
return true;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static unsigned
|
||||
ParseSubtuneName(const char *base) noexcept
|
||||
{
|
||||
|
|
|
@ -50,7 +50,7 @@ static constexpr unsigned DECODERDELAY = 529;
|
|||
|
||||
static constexpr Domain mad_domain("mad");
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static SongTime
|
||||
ToSongTime(mad_timer_t t) noexcept
|
||||
{
|
||||
|
@ -135,10 +135,10 @@ private:
|
|||
void ParseId3(size_t tagsize, Tag *tag) noexcept;
|
||||
MadDecoderAction DecodeNextFrame(bool skip, Tag *tag) noexcept;
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
offset_type ThisFrameOffset() const noexcept;
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
offset_type RestIncludingThisFrame() const noexcept;
|
||||
|
||||
/**
|
||||
|
@ -157,7 +157,7 @@ private:
|
|||
times = new mad_timer_t[max_frames];
|
||||
}
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
size_t TimeToFrame(SongTime t) const noexcept;
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,15 +33,15 @@ constexpr opus_int32 opus_sample_rate = 48000;
|
|||
*/
|
||||
constexpr unsigned opus_output_buffer_frames = opus_sample_rate / 4;
|
||||
|
||||
gcc_pure
|
||||
bool
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsOpusHead(const ogg_packet &packet) noexcept
|
||||
{
|
||||
return packet.bytes >= 8 && memcmp(packet.packet, "OpusHead", 8) == 0;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
bool
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsOpusTags(const ogg_packet &packet) noexcept
|
||||
{
|
||||
return packet.bytes >= 8 && memcmp(packet.packet, "OpusTags", 8) == 0;
|
||||
|
@ -50,7 +50,7 @@ IsOpusTags(const ogg_packet &packet) noexcept
|
|||
/**
|
||||
* Convert an EBU R128 value to ReplayGain.
|
||||
*/
|
||||
constexpr float
|
||||
static constexpr float
|
||||
EbuR128ToReplayGain(float ebu_r128) noexcept
|
||||
{
|
||||
/* add 5dB to compensate for the different reference levels
|
||||
|
@ -58,7 +58,7 @@ EbuR128ToReplayGain(float ebu_r128) noexcept
|
|||
return ebu_r128 + 5;
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
mpd_opus_init([[maybe_unused]] const ConfigBlock &block)
|
||||
{
|
||||
LogDebug(opus_domain, opus_get_version_string());
|
||||
|
@ -300,7 +300,7 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet)
|
|||
packet.bytes,
|
||||
output_buffer, opus_output_buffer_frames,
|
||||
0);
|
||||
if (gcc_unlikely(nframes <= 0)) {
|
||||
if (nframes <= 0) [[unlikely]] {
|
||||
if (nframes < 0)
|
||||
throw FmtRuntimeError("libopus error: {}",
|
||||
opus_strerror(nframes));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
using std::string_view_literals::operator""sv;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static TagType
|
||||
ParseOpusTagName(std::string_view name) noexcept
|
||||
{
|
||||
|
|
|
@ -149,7 +149,7 @@ struct SidplayContainerPath {
|
|||
unsigned track;
|
||||
};
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static unsigned
|
||||
ParseSubtuneName(const char *base) noexcept
|
||||
{
|
||||
|
@ -458,7 +458,7 @@ Windows1252ToUTF8(const char *s) noexcept
|
|||
return t;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedString
|
||||
GetInfoString(const SidTuneInfo &info, unsigned i) noexcept
|
||||
{
|
||||
|
@ -475,7 +475,7 @@ GetInfoString(const SidTuneInfo &info, unsigned i) noexcept
|
|||
return Windows1252ToUTF8(s);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static AllocatedString
|
||||
GetDateString(const SidTuneInfo &info) noexcept
|
||||
{
|
||||
|
|
|
@ -128,7 +128,7 @@ sndfile_duration(const SF_INFO &info)
|
|||
return SongTime::FromScale<uint64_t>(info.frames, info.samplerate);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static SampleFormat
|
||||
sndfile_sample_format(const SF_INFO &info) noexcept
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "BufferedSocket.hxx"
|
||||
#include "net/SocketError.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
@ -11,7 +10,7 @@ BufferedSocket::ssize_t
|
|||
BufferedSocket::DirectRead(void *data, size_t length) noexcept
|
||||
{
|
||||
const auto nbytes = GetSocket().Read((char *)data, length);
|
||||
if (gcc_likely(nbytes > 0))
|
||||
if (nbytes > 0) [[likely]]
|
||||
return nbytes;
|
||||
|
||||
if (nbytes == 0) {
|
||||
|
@ -86,7 +85,7 @@ BufferedSocket::OnSocketReady(unsigned flags) noexcept
|
|||
{
|
||||
assert(IsDefined());
|
||||
|
||||
if (gcc_unlikely(flags & (SocketEvent::ERROR|SocketEvent::HANGUP))) {
|
||||
if (flags & (SocketEvent::ERROR|SocketEvent::HANGUP)) [[unlikely]] {
|
||||
OnSocketClosed();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "FullyBufferedSocket.hxx"
|
||||
#include "net/SocketError.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
@ -13,7 +12,7 @@ FullyBufferedSocket::ssize_t
|
|||
FullyBufferedSocket::DirectWrite(const void *data, size_t length) noexcept
|
||||
{
|
||||
const auto nbytes = GetSocket().Write((const char *)data, length);
|
||||
if (gcc_unlikely(nbytes < 0)) {
|
||||
if (nbytes < 0) [[unlikely]] {
|
||||
const auto code = GetSocketError();
|
||||
if (IsSocketErrorSendWouldBlock(code))
|
||||
return 0;
|
||||
|
@ -43,7 +42,7 @@ FullyBufferedSocket::Flush() noexcept
|
|||
}
|
||||
|
||||
auto nbytes = DirectWrite(data.data(), data.size());
|
||||
if (gcc_unlikely(nbytes <= 0))
|
||||
if (nbytes <= 0) [[unlikely]]
|
||||
return nbytes == 0;
|
||||
|
||||
output.Consume(nbytes);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
static constexpr const char *hdcd_graph = "hdcd";
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
MaybeHdcd(const AudioFormat &audio_format) noexcept
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "filter/FilterPlugin.hxx"
|
||||
#include "filter/NullFilter.hxx"
|
||||
#include "filter/Prepared.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
class PreparedNullFilter final : public PreparedFilter {
|
||||
public:
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "FileInfo.hxx"
|
||||
#include "system/Error.hxx"
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static PathTraitsFS::pointer
|
||||
FindSlash(PathTraitsFS::pointer p, size_t i) noexcept
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ InputStream::SetReady() noexcept
|
|||
* seeking in a HTTP file requires opening a new connection with a new
|
||||
* HTTP request.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
ExpensiveSeeking(const char *uri) noexcept
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ BufferedOutputStream::Format(const char *fmt, ...)
|
|||
std::size_t size = vsnprintf((char *)r.data(), r.size(), fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
if (gcc_unlikely(size >= r.size())) {
|
||||
if (size >= r.size()) [[unlikely]] {
|
||||
/* buffer was not large enough; flush it and try
|
||||
again */
|
||||
|
||||
|
@ -75,7 +75,7 @@ BufferedOutputStream::Format(const char *fmt, ...)
|
|||
|
||||
r = buffer.Write();
|
||||
|
||||
if (gcc_unlikely(size >= r.size())) {
|
||||
if (size >= r.size()) [[unlikely]] {
|
||||
/* still not enough space: grow the buffer and
|
||||
try again */
|
||||
++size;
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "ObjectManager.hxx"
|
||||
#include "util/SpanCast.hxx"
|
||||
#include "util/StringAPI.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
@ -15,7 +14,7 @@
|
|||
namespace UDisks2 {
|
||||
|
||||
template<typename I>
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *
|
||||
CheckString(I &&i) noexcept
|
||||
{
|
||||
|
@ -26,7 +25,7 @@ CheckString(I &&i) noexcept
|
|||
}
|
||||
|
||||
template<typename I>
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static std::string_view
|
||||
CheckRecursedByteArrayToString(I &&i) noexcept
|
||||
{
|
||||
|
@ -38,7 +37,7 @@ CheckRecursedByteArrayToString(I &&i) noexcept
|
|||
}
|
||||
|
||||
template<typename I>
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static std::string_view
|
||||
CheckByteArrayToString(I &&i) noexcept
|
||||
{
|
||||
|
@ -49,7 +48,7 @@ CheckByteArrayToString(I &&i) noexcept
|
|||
}
|
||||
|
||||
template<typename I>
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static std::string_view
|
||||
CheckByteArrayArrayFrontToString(I &&i) noexcept
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "Lease.hxx"
|
||||
#include "Callback.hxx"
|
||||
#include "event/InjectEvent.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#ifndef MPD_SQLITE_UTIL_HXX
|
||||
#define MPD_SQLITE_UTIL_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "Error.hxx"
|
||||
|
||||
#include <sqlite3.h>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_UPNP_ACTION_HXX
|
||||
#define MPD_UPNP_ACTION_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <upnptools.h>
|
||||
|
||||
static constexpr unsigned
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "FlacIOHandle.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "system/Error.hxx"
|
||||
|
||||
#include <cerrno>
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_FLAC_METADATA_ITERATOR_HXX
|
||||
#define MPD_FLAC_METADATA_ITERATOR_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <FLAC/metadata.h>
|
||||
|
||||
class FlacMetadataIterator {
|
||||
|
@ -31,7 +29,7 @@ public:
|
|||
return ::FLAC__metadata_iterator_next(iterator);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
FLAC__StreamMetadata *GetBlock() noexcept {
|
||||
return ::FLAC__metadata_iterator_get_block(iterator);
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ flac_scan_comments(const FLAC__StreamMetadata_VorbisComment *comment,
|
|||
ScanVorbisComment(ToStringView(comment->comments[i]), handler);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static inline SongTime
|
||||
flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info) noexcept
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
static constexpr Domain mixer_domain("mixer");
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static int
|
||||
output_mixer_get_volume(const AudioOutputControl &ao) noexcept
|
||||
{
|
||||
|
|
|
@ -228,7 +228,7 @@ AlsaMixer::~AlsaMixer()
|
|||
snd_config_update_free_global();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static snd_mixer_elem_t *
|
||||
alsa_mixer_lookup_elem(snd_mixer_t *handle,
|
||||
const char *name, unsigned idx) noexcept
|
||||
|
|
|
@ -48,7 +48,7 @@ software_mixer_init([[maybe_unused]] EventLoop &event_loop,
|
|||
return new SoftwareMixer(listener);
|
||||
}
|
||||
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static unsigned
|
||||
PercentVolumeToSoftwareVolume(unsigned volume) noexcept
|
||||
{
|
||||
|
|
|
@ -146,13 +146,13 @@ public:
|
|||
/**
|
||||
* Does the plugin support enabling/disabling a device?
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool SupportsEnableDisable() const noexcept;
|
||||
|
||||
/**
|
||||
* Does the plugin support pausing a device?
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool SupportsPause() const noexcept;
|
||||
|
||||
std::map<std::string, std::string> GetAttributes() const noexcept;
|
||||
|
@ -204,7 +204,7 @@ public:
|
|||
|
||||
void Interrupt() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::chrono::steady_clock::duration Delay() noexcept;
|
||||
|
||||
void SendTag(const Tag &tag);
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#include "Interface.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_OUTPUT_PLUGIN_HXX
|
||||
#define MPD_OUTPUT_PLUGIN_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
struct ConfigBlock;
|
||||
class AudioOutput;
|
||||
struct MixerPlugin;
|
||||
|
@ -54,7 +52,7 @@ ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
|
|||
: false;
|
||||
}
|
||||
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
[[gnu::malloc]] [[gnu::returns_nonnull]]
|
||||
AudioOutput *
|
||||
ao_plugin_init(EventLoop &event_loop,
|
||||
const AudioOutputPlugin &plugin,
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef SHARED_PIPE_CONSUMER_HXX
|
||||
#define SHARED_PIPE_CONSUMER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
struct MusicChunk;
|
||||
|
@ -67,7 +65,7 @@ public:
|
|||
consumed = true;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool IsConsumed(const MusicChunk &_chunk) const noexcept;
|
||||
|
||||
void ClearTail([[maybe_unused]] const MusicChunk &_chunk) noexcept {
|
||||
|
|
|
@ -246,7 +246,7 @@ public:
|
|||
|
||||
using MultiSocketMonitor::GetEventLoop;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *GetDevice() const noexcept {
|
||||
return device.empty() ? default_device : device.c_str();
|
||||
}
|
||||
|
@ -292,13 +292,13 @@ private:
|
|||
#endif
|
||||
);
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool LockIsActive() const noexcept {
|
||||
const std::scoped_lock<Mutex> lock(mutex);
|
||||
return active;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool LockIsActiveAndNotWaiting() const noexcept {
|
||||
const std::scoped_lock<Mutex> lock(mutex);
|
||||
return active && !waiting;
|
||||
|
@ -654,7 +654,7 @@ MaybeDmix(snd_pcm_type_t type)
|
|||
return type == SND_PCM_TYPE_DMIX || type == SND_PCM_TYPE_PLUG;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
MaybeDmix(snd_pcm_t *pcm) noexcept
|
||||
{
|
||||
|
|
|
@ -124,7 +124,7 @@ private:
|
|||
* Determine the number of frames guaranteed to be available
|
||||
* on all channels.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
jack_nframes_t GetAvailable() const noexcept;
|
||||
|
||||
void Process(jack_nframes_t nframes);
|
||||
|
|
|
@ -525,7 +525,7 @@ osx_output_hog_device(AudioDeviceID dev_id, bool hog) noexcept
|
|||
}
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsAudioDeviceName(AudioDeviceID id, const char *expected_name) noexcept
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ private:
|
|||
void Open(AudioFormat &audio_format) override;
|
||||
void Close() noexcept override;
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
std::chrono::steady_clock::duration Delay() const noexcept override {
|
||||
return filled < NUM_BUFFERS || HasProcessed()
|
||||
? std::chrono::steady_clock::duration::zero()
|
||||
|
@ -57,19 +57,19 @@ private:
|
|||
|
||||
void Cancel() noexcept override;
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
ALint GetSourceI(ALenum param) const noexcept {
|
||||
ALint value;
|
||||
alGetSourcei(source, param, &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
bool HasProcessed() const noexcept {
|
||||
return GetSourceI(AL_BUFFERS_PROCESSED) > 0;
|
||||
}
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
bool IsPlaying() const noexcept {
|
||||
return GetSourceI(AL_SOURCE_STATE) == AL_PLAYING;
|
||||
}
|
||||
|
|
|
@ -372,8 +372,7 @@ oss_setup_sample_rate(FileDescriptor fd, AudioFormat &audio_format,
|
|||
* Convert a MPD sample format to its OSS counterpart. Returns
|
||||
* AFMT_QUERY if there is no direct counterpart.
|
||||
*/
|
||||
gcc_const
|
||||
static int
|
||||
static constexpr int
|
||||
sample_format_to_oss(SampleFormat format) noexcept
|
||||
{
|
||||
switch (format) {
|
||||
|
@ -411,8 +410,7 @@ sample_format_to_oss(SampleFormat format) noexcept
|
|||
* Convert an OSS sample format to its MPD counterpart. Returns
|
||||
* SampleFormat::UNDEFINED if there is no direct counterpart.
|
||||
*/
|
||||
gcc_const
|
||||
static SampleFormat
|
||||
static constexpr SampleFormat
|
||||
sample_format_from_oss(int format) noexcept
|
||||
{
|
||||
switch (format) {
|
||||
|
|
|
@ -72,7 +72,7 @@ private:
|
|||
|
||||
std::size_t Play(std::span<const std::byte> src) override;
|
||||
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
bool HasDynamicPath() const noexcept {
|
||||
return !format_path.empty();
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
|
||||
#ifdef ENABLE_WINMM_OUTPUT
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <windef.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
|
@ -17,7 +15,7 @@ class WinmmOutput;
|
|||
|
||||
extern const struct AudioOutputPlugin winmm_output_plugin;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
HWAVEOUT
|
||||
winmm_output_get_handle(WinmmOutput &output);
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ HttpdClient::SendResponse() noexcept
|
|||
}
|
||||
|
||||
ssize_t nbytes = GetSocket().Write(response, strlen(response));
|
||||
if (gcc_unlikely(nbytes < 0)) {
|
||||
if (nbytes < 0) [[unlikely]] {
|
||||
const SocketErrorMessage msg;
|
||||
FmtWarning(httpd_output_domain,
|
||||
"failed to write to client: {}",
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "Page.hxx"
|
||||
#include "event/BufferedSocket.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "util/IntrusiveList.hxx"
|
||||
|
||||
#include <cstddef>
|
||||
|
@ -156,7 +155,7 @@ public:
|
|||
*/
|
||||
bool SendResponse() noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
ssize_t GetBytesTillMetaData() const noexcept;
|
||||
|
||||
ssize_t TryWritePage(const Page &page, size_t position) noexcept;
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "event/ServerSocket.hxx"
|
||||
#include "event/InjectEvent.hxx"
|
||||
#include "util/Cast.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "util/IntrusiveList.hxx"
|
||||
|
||||
#include <queue>
|
||||
|
@ -173,7 +172,7 @@ public:
|
|||
*
|
||||
* Caller must lock the mutex.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool HasClients() const noexcept {
|
||||
return !clients.empty();
|
||||
}
|
||||
|
@ -181,7 +180,7 @@ public:
|
|||
/**
|
||||
* Check whether there is at least one client.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool LockHasClients() const noexcept {
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
return HasClients();
|
||||
|
@ -205,7 +204,7 @@ public:
|
|||
*/
|
||||
void SendHeader(HttpdClient &client) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::chrono::steady_clock::duration Delay() const noexcept override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_PCM_UTILS_H
|
||||
#define MPD_PCM_UTILS_H
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
|
||||
|
@ -26,10 +24,10 @@ PcmClamp(typename Traits::long_type x) noexcept
|
|||
static_assert(Traits::MIN >= limits::min(), "out of range");
|
||||
static_assert(Traits::MAX <= limits::max(), "out of range");
|
||||
|
||||
if (gcc_unlikely(x < Traits::MIN))
|
||||
if (x < Traits::MIN) [[unlikely]]
|
||||
return T(Traits::MIN);
|
||||
|
||||
if (gcc_unlikely(x > Traits::MAX))
|
||||
if (x > Traits::MAX) [[unlikely]]
|
||||
return T(Traits::MAX);
|
||||
|
||||
return T(x);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#define MPD_PCM_MIX_HXX
|
||||
|
||||
#include "SampleFormat.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
|
|
@ -43,8 +43,7 @@ ConstructS24(uint8_t low, uint8_t mid, uint8_t high) noexcept
|
|||
/**
|
||||
* Read a packed signed little-endian 24 bit integer.
|
||||
*/
|
||||
gcc_pure
|
||||
static int32_t
|
||||
static constexpr int32_t
|
||||
ReadS24LE(const uint8_t *src) noexcept
|
||||
{
|
||||
return ConstructS24(src[0], src[1], src[2]);
|
||||
|
@ -53,8 +52,7 @@ ReadS24LE(const uint8_t *src) noexcept
|
|||
/**
|
||||
* Read a packed signed big-endian 24 bit integer.
|
||||
*/
|
||||
gcc_pure
|
||||
static int32_t
|
||||
static constexpr int32_t
|
||||
ReadS24BE(const uint8_t *src) noexcept
|
||||
{
|
||||
return ConstructS24(src[2], src[1], src[0]);
|
||||
|
@ -63,7 +61,7 @@ ReadS24BE(const uint8_t *src) noexcept
|
|||
/**
|
||||
* Read a packed signed native-endian 24 bit integer.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static int32_t
|
||||
ReadS24(const uint8_t *src) noexcept
|
||||
{
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_PCM_RESAMPLER_HXX
|
||||
#define MPD_PCM_RESAMPLER_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <span>
|
||||
|
||||
|
|
|
@ -48,8 +48,7 @@ static constexpr struct {
|
|||
{ SOXR_INVALID_RECIPE, nullptr }
|
||||
};
|
||||
|
||||
gcc_const
|
||||
static const char *
|
||||
static constexpr const char *
|
||||
soxr_quality_name(unsigned long recipe) noexcept
|
||||
{
|
||||
for (const auto *i = soxr_quality_table;; ++i) {
|
||||
|
@ -60,7 +59,7 @@ soxr_quality_name(unsigned long recipe) noexcept
|
|||
}
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static unsigned long
|
||||
soxr_parse_quality(const char *quality) noexcept
|
||||
{
|
||||
|
|
|
@ -22,7 +22,7 @@ CrossFadeSettings::CanCrossFadeSong(SignedSongTime total_time) const noexcept
|
|||
duration < std::chrono::duration_cast<FloatDuration>(total_time);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static FloatDuration
|
||||
mixramp_interpolate(const char *ramp_list, float required_db) noexcept
|
||||
{
|
||||
|
|
|
@ -237,7 +237,7 @@ private:
|
|||
* Note: this function does not check if the decoder is already
|
||||
* finished.
|
||||
*/
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
bool IsDecoderAtCurrentSong() const noexcept {
|
||||
assert(pipe != nullptr);
|
||||
|
||||
|
@ -249,7 +249,7 @@ private:
|
|||
* decoding it, or has finished doing it), and the player hasn't
|
||||
* switched to that song yet.
|
||||
*/
|
||||
[[nodiscard]] gcc_pure
|
||||
[[nodiscard]] [[gnu::pure]]
|
||||
bool IsDecoderAtNextSong() const noexcept {
|
||||
return dc.pipe != nullptr && !IsDecoderAtCurrentSong();
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "input/Ptr.hxx"
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string_view>
|
||||
|
||||
|
@ -104,19 +103,19 @@ struct PlaylistPlugin {
|
|||
/**
|
||||
* Does the plugin announce the specified URI scheme?
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
bool SupportsScheme(std::string_view scheme) const noexcept;
|
||||
|
||||
/**
|
||||
* Does the plugin announce the specified file name suffix?
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
bool SupportsSuffix(std::string_view suffix) const noexcept;
|
||||
|
||||
/**
|
||||
* Does the plugin announce the specified MIME type?
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]]
|
||||
bool SupportsMimeType(std::string_view mime_type) const noexcept;
|
||||
};
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#define MPD_PLAYLIST_STREAM_HXX
|
||||
|
||||
#include "thread/Mutex.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -18,11 +17,10 @@ class Path;
|
|||
* @param path the path of the playlist file
|
||||
* @return a playlist, or nullptr on error
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
std::unique_ptr<SongEnumerator>
|
||||
playlist_open_path(Path path, Mutex &mutex);
|
||||
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
std::unique_ptr<SongEnumerator>
|
||||
playlist_open_remote(const char *uri, Mutex &mutex);
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "tag/Builder.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -108,7 +107,7 @@ public:
|
|||
std::unique_ptr<DetachedSong> Get() noexcept;
|
||||
|
||||
private:
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
TagBuilder *GetCurrentTag() noexcept;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_ID_TABLE_HXX
|
||||
#define MPD_ID_TABLE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,17 +96,17 @@ struct playlist {
|
|||
return queue.PositionToId(position);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
int GetCurrentPosition() const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
int GetNextPosition() const noexcept;
|
||||
|
||||
/**
|
||||
* Returns the song object which is currently queued. Returns
|
||||
* none if there is none (yet?) or if MPD isn't playing.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const DetachedSong *GetQueuedSong() const noexcept;
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#ifndef MPD_QUEUE_HXX
|
||||
#define MPD_QUEUE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
#include "IdTable.hxx"
|
||||
#include "SingleMode.hxx"
|
||||
#include "ConsumeMode.hxx"
|
||||
|
@ -141,14 +140,14 @@ struct Queue {
|
|||
return items[position].id;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned OrderToPosition(unsigned _order) const noexcept {
|
||||
assert(_order < length);
|
||||
|
||||
return order[_order];
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned PositionToOrder(unsigned position) const noexcept {
|
||||
assert(position < length);
|
||||
|
||||
|
@ -160,7 +159,7 @@ struct Queue {
|
|||
}
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
uint8_t GetPriorityAtPosition(unsigned position) const noexcept {
|
||||
assert(position < length);
|
||||
|
||||
|
@ -217,7 +216,7 @@ struct Queue {
|
|||
*
|
||||
* @return the next order number, or -1 to stop playback
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
int GetNextOrder(unsigned order) const noexcept;
|
||||
|
||||
/**
|
||||
|
@ -375,11 +374,11 @@ private:
|
|||
* Find the first item that has this specified priority or
|
||||
* higher.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned FindPriorityOrder(unsigned start_order, uint8_t priority,
|
||||
unsigned exclude_order) const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
unsigned CountSamePriority(unsigned start_order,
|
||||
uint8_t priority) const noexcept;
|
||||
};
|
||||
|
|
|
@ -4,11 +4,9 @@
|
|||
#ifndef MPD_SONG_ESCAPE_HXX
|
||||
#define MPD_SONG_ESCAPE_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string
|
||||
EscapeFilterString(const std::string &src) noexcept;
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ enum {
|
|||
/**
|
||||
* @return #TAG_NUM_OF_ITEM_TYPES on error
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static unsigned
|
||||
locate_parse_type(const char *str) noexcept
|
||||
{
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_STORAGE_REGISTRY_HXX
|
||||
#define MPD_STORAGE_REGISTRY_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct StoragePlugin;
|
||||
|
@ -18,15 +16,15 @@ class EventLoop;
|
|||
*/
|
||||
extern const StoragePlugin *const storage_plugins[];
|
||||
|
||||
gcc_nonnull_all gcc_pure
|
||||
[[gnu::nonnull]] [[gnu::pure]]
|
||||
const StoragePlugin *
|
||||
GetStoragePluginByName(const char *name) noexcept;
|
||||
|
||||
gcc_nonnull_all gcc_pure
|
||||
[[gnu::nonnull]] [[gnu::pure]]
|
||||
const StoragePlugin *
|
||||
GetStoragePluginByUri(const char *uri) noexcept;
|
||||
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
std::unique_ptr<Storage>
|
||||
CreateStorageURI(EventLoop &event_loop, const char *uri);
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ ParseU64(const char *s, size_t length) noexcept
|
|||
return ParseU64(std::string(s, length).c_str());
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsXmlContentType(const char *content_type) noexcept
|
||||
{
|
||||
|
@ -211,7 +211,7 @@ IsXmlContentType(const char *content_type) noexcept
|
|||
StringStartsWith(content_type, "application/xml");
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
IsXmlContentType(const Curl::Headers &headers) noexcept
|
||||
{
|
||||
|
@ -456,7 +456,7 @@ CurlStorage::GetInfo(std::string_view uri_utf8, [[maybe_unused]] bool follow)
|
|||
return HttpGetInfoOperation(*curl, uri.c_str()).Perform();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static std::string_view
|
||||
UriPathOrSlash(const char *uri) noexcept
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ private:
|
|||
* Convert a "href" attribute (which may be an absolute URI)
|
||||
* to the base file name.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string_view HrefToEscapedName(const char *href) const noexcept {
|
||||
std::string_view path = uri_get_path(href);
|
||||
if (path.data() == nullptr)
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef MPD_STORAGE_LOCAL_HXX
|
||||
#define MPD_STORAGE_LOCAL_HXX
|
||||
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
struct StoragePlugin;
|
||||
|
@ -14,7 +12,6 @@ class Path;
|
|||
|
||||
extern const StoragePlugin local_storage_plugin;
|
||||
|
||||
gcc_nonnull_all
|
||||
std::unique_ptr<Storage>
|
||||
CreateLocalStorage(Path base_fs);
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ NfsStorage::GetInfo(std::string_view uri_utf8, bool follow)
|
|||
return operation.GetInfo();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
SkipNameFS(PathTraitsFS::const_pointer name) noexcept
|
||||
{
|
||||
|
|
|
@ -133,7 +133,7 @@ SmbclientStorage::OpenDirectory(std::string_view uri_utf8)
|
|||
handle);
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static bool
|
||||
SkipNameFS(PathTraitsFS::const_pointer name) noexcept
|
||||
{
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#define MPD_TAG_HANDLER_HXX
|
||||
|
||||
#include "Chrono.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#define ID3_FRAME_MOOD "TMOO"
|
||||
#endif
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static Id3String
|
||||
tag_id3_getstring(const struct id3_frame *frame, unsigned i) noexcept
|
||||
{
|
||||
|
@ -186,7 +186,7 @@ tag_id3_import_comment(const struct id3_tag *tag, const char *id, TagType type,
|
|||
* Parse a TXXX name, and convert it to a TagType enum value.
|
||||
* Returns TAG_NUM_OF_ITEM_TYPES if the TXXX name is not understood.
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static TagType
|
||||
tag_id3_parse_txxx_name(const char *name) noexcept
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@ ParseReplayGainTag(ReplayGainInfo &info,
|
|||
const char *name;
|
||||
const char *value;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *operator[](const char *n) const noexcept {
|
||||
return StringEqualsCaseASCII(name, n)
|
||||
? value
|
||||
|
@ -60,7 +60,7 @@ ParseReplayGainVorbis(ReplayGainInfo &info, std::string_view entry) noexcept
|
|||
struct VorbisCommentEntry {
|
||||
std::string_view entry;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
const char *operator[](std::string_view n) const noexcept {
|
||||
return GetVorbisCommentValue(entry, n).data();
|
||||
}
|
||||
|
|
|
@ -4,20 +4,21 @@
|
|||
#ifndef CLAMP_HPP
|
||||
#define CLAMP_HPP
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
/**
|
||||
* Clamps the specified value in a range. Returns #min or #max if the
|
||||
* value is outside.
|
||||
*/
|
||||
template<typename T>
|
||||
constexpr const T &
|
||||
Clamp(const T &value, const T &min, const T &max)
|
||||
Clamp(const T &value, const T &min, const T &max) noexcept
|
||||
{
|
||||
return gcc_unlikely(value < min)
|
||||
? min
|
||||
: (gcc_unlikely(value > max)
|
||||
? max : value);
|
||||
if (value < min) [[unlikely]]
|
||||
return min;
|
||||
|
||||
if (value > max) [[unlikely]]
|
||||
return max;
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef REUSABLE_ARRAY_HXX
|
||||
#define REUSABLE_ARRAY_HXX
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
||||
|
@ -59,7 +57,7 @@ public:
|
|||
*/
|
||||
[[gnu::malloc]] [[gnu::returns_nonnull]]
|
||||
T *Get(size_t size) {
|
||||
if (gcc_unlikely(size > capacity)) {
|
||||
if (size > capacity) [[unlikely]] {
|
||||
/* too small: grow */
|
||||
delete[] buffer;
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#include "Serial.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
|
@ -13,7 +12,7 @@ int
|
|||
GenerateSerial() noexcept
|
||||
{
|
||||
unsigned serial = ++next_serial;
|
||||
if (gcc_unlikely(serial < 16)) {
|
||||
if (serial < 16) [[unlikely]] {
|
||||
/* first-time initialization: seed with a clock value,
|
||||
which is random enough for our use */
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef STRING_UTIL_HXX
|
||||
#define STRING_UTIL_HXX
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
|
||||
|
@ -17,7 +15,7 @@
|
|||
* case-insensitive for ASCII characters
|
||||
* @return true if found
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool
|
||||
StringArrayContainsCase(const char *const*haystack,
|
||||
std::string_view needle) noexcept;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// author: Max Kellermann <max.kellermann@gmail.com>
|
||||
|
||||
#include "TruncateString.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#ifndef TRUNCATE_STRING_HXX
|
||||
#define TRUNCATE_STRING_HXX
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
/**
|
||||
|
@ -16,7 +14,7 @@
|
|||
* terminator)
|
||||
* @return a pointer to the null terminator
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
char *
|
||||
CopyTruncateString(char *dest, const char *src, size_t size) noexcept;
|
||||
|
||||
|
|
|
@ -272,9 +272,9 @@ Latin1ToUTF8(const char *gcc_restrict src, char *gcc_restrict buffer,
|
|||
char *
|
||||
UnicodeToUTF8(unsigned ch, char *q) noexcept
|
||||
{
|
||||
if (gcc_likely(ch < 0x80)) {
|
||||
if (ch < 0x80) [[likely]] {
|
||||
*q++ = (char)ch;
|
||||
} else if (gcc_likely(ch < 0x800)) {
|
||||
} else if (ch < 0x800) [[likely]] {
|
||||
*q++ = MakeLeading1(ch >> 6);
|
||||
*q++ = MakeContinuation(ch);
|
||||
} else if (ch < 0x10000) {
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
// Copyright The Music Player Daemon Project
|
||||
|
||||
#include "Main.hxx"
|
||||
#include "util/Compiler.h"
|
||||
#include "Instance.hxx"
|
||||
#include "system/Error.hxx"
|
||||
#include "Log.hxx"
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
#include "Bonjour.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <dns_sd.h>
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
#include "Listen.hxx"
|
||||
#include "util/Domain.hxx"
|
||||
#include "Log.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#ifdef HAVE_AVAHI
|
||||
#include "avahi/Helper.hxx"
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include "input/InputStream.hxx"
|
||||
#include "tag/Names.hxx"
|
||||
#include "util/StringBuffer.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include "tag/Builder.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
inline void
|
||||
BuildTag([[maybe_unused]] TagBuilder &tag) noexcept
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "fs/LookupFile.hxx"
|
||||
#include "util/Compiler.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue