use [[gnu::...]] attributes

This commit is contained in:
Max Kellermann 2023-03-06 15:57:36 +01:00
parent 3b9aab0684
commit 42f6a0441c
101 changed files with 167 additions and 234 deletions

View File

@ -17,7 +17,7 @@
/** /**
* Does the #DecoderPlugin support either the suffix or the MIME type? * Does the #DecoderPlugin support either the suffix or the MIME type?
*/ */
gcc_pure [[gnu::pure]]
static bool static bool
CheckDecoderPlugin(const DecoderPlugin &plugin, CheckDecoderPlugin(const DecoderPlugin &plugin,
std::string_view suffix, std::string_view mime) noexcept std::string_view suffix, std::string_view mime) noexcept

View File

@ -204,7 +204,7 @@ static constexpr struct command commands[] = {
static constexpr unsigned num_commands = std::size(commands); static constexpr unsigned num_commands = std::size(commands);
gcc_pure [[gnu::pure]]
static bool static bool
command_available([[maybe_unused]] const Partition &partition, command_available([[maybe_unused]] const Partition &partition,
[[maybe_unused]] const struct command *cmd) noexcept [[maybe_unused]] const struct command *cmd) noexcept
@ -290,7 +290,7 @@ command_init() noexcept
#endif #endif
} }
gcc_pure [[gnu::pure]]
static const struct command * static const struct command *
command_lookup(const char *name) noexcept command_lookup(const char *name) noexcept
{ {

View File

@ -34,14 +34,14 @@
#include <cassert> #include <cassert>
#include <array> #include <array>
gcc_pure [[gnu::pure]]
static bool static bool
SkipNameFS(PathTraitsFS::const_pointer name_fs) noexcept SkipNameFS(PathTraitsFS::const_pointer name_fs) noexcept
{ {
return PathTraitsFS::IsSpecialFilename(name_fs); return PathTraitsFS::IsSpecialFilename(name_fs);
} }
gcc_pure [[gnu::pure]]
static bool static bool
skip_path(Path name_fs) noexcept skip_path(Path name_fs) noexcept
{ {
@ -87,7 +87,7 @@ handle_listfiles_local(Response &r, Path path_fs)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
gcc_pure [[gnu::pure]]
static bool static bool
IsValidName(const std::string_view s) noexcept IsValidName(const std::string_view s) noexcept
{ {
@ -99,7 +99,7 @@ IsValidName(const std::string_view s) noexcept
}); });
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsValidValue(const std::string_view s) noexcept IsValidValue(const std::string_view s) noexcept
{ {

View File

@ -101,7 +101,7 @@ GetChromaprintCommand::DecodeStream(InputStream &input_stream,
plugin.StreamDecode(*this, input_stream); plugin.StreamDecode(*this, input_stream);
} }
gcc_pure [[gnu::pure]]
static bool static bool
decoder_check_plugin_mime(const DecoderPlugin &plugin, decoder_check_plugin_mime(const DecoderPlugin &plugin,
const InputStream &is) noexcept const InputStream &is) noexcept
@ -113,7 +113,7 @@ decoder_check_plugin_mime(const DecoderPlugin &plugin,
plugin.SupportsMimeType(GetMimeTypeBase(mime_type)); plugin.SupportsMimeType(GetMimeTypeBase(mime_type));
} }
gcc_pure [[gnu::pure]]
static bool static bool
decoder_check_plugin_suffix(const DecoderPlugin &plugin, decoder_check_plugin_suffix(const DecoderPlugin &plugin,
std::string_view suffix) noexcept std::string_view suffix) noexcept
@ -123,7 +123,7 @@ decoder_check_plugin_suffix(const DecoderPlugin &plugin,
return !suffix.empty() && plugin.SupportsSuffix(suffix); return !suffix.empty() && plugin.SupportsSuffix(suffix);
} }
gcc_pure [[gnu::pure]]
static bool static bool
decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is, decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is,
std::string_view suffix) noexcept std::string_view suffix) noexcept

View File

@ -71,7 +71,7 @@ IsValidAttributeNameChar(char ch) noexcept
return IsAlphaNumericASCII(ch) || ch == '_'; return IsAlphaNumericASCII(ch) || ch == '_';
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsValidAttributeName(const char *s) noexcept IsValidAttributeName(const char *s) noexcept
{ {

View File

@ -44,7 +44,7 @@ IsValidPartitionChar(char ch)
return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_'; return IsAlphaNumericASCII(ch) || ch == '-' || ch == '_';
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsValidPartitionName(const char *name) noexcept IsValidPartitionName(const char *name) noexcept
{ {
@ -56,7 +56,7 @@ IsValidPartitionName(const char *name) noexcept
return true; return true;
} }
gcc_pure [[gnu::pure]]
static bool static bool
HasPartitionNamed(Instance &instance, const char *name) noexcept HasPartitionNamed(Instance &instance, const char *name) noexcept
{ {

View File

@ -22,7 +22,7 @@
#include <memory> #include <memory>
gcc_pure [[gnu::pure]]
static bool static bool
skip_path(const char *name_utf8) noexcept skip_path(const char *name_utf8) noexcept
{ {

View File

@ -20,7 +20,7 @@ ConfigData::Clear()
} }
template<typename T> template<typename T>
gcc_pure [[gnu::pure]]
static auto static auto
FindLast(const std::forward_list<T> &list) FindLast(const std::forward_list<T> &list)
{ {

View File

@ -4,8 +4,6 @@
#ifndef MPD_CONFIG_PARAM_HXX #ifndef MPD_CONFIG_PARAM_HXX
#define MPD_CONFIG_PARAM_HXX #define MPD_CONFIG_PARAM_HXX
#include "util/Compiler.h"
#include <string> #include <string>
class AllocatedPath; class AllocatedPath;

View File

@ -89,7 +89,7 @@ static constexpr unsigned n_config_block_templates =
static_assert(n_config_block_templates == unsigned(ConfigBlockOption::MAX), static_assert(n_config_block_templates == unsigned(ConfigBlockOption::MAX),
"Wrong number of config_block_templates"); "Wrong number of config_block_templates");
gcc_pure [[gnu::pure]]
static inline unsigned static inline unsigned
ParseConfigTemplateName(const ConfigTemplate templates[], unsigned count, ParseConfigTemplateName(const ConfigTemplate templates[], unsigned count,
const char *name) noexcept const char *name) noexcept

View File

@ -4,8 +4,6 @@
#ifndef MPD_DB_COUNT_HXX #ifndef MPD_DB_COUNT_HXX
#define MPD_DB_COUNT_HXX #define MPD_DB_COUNT_HXX
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
enum TagType : uint8_t; enum TagType : uint8_t;
@ -13,7 +11,6 @@ struct Partition;
class Response; class Response;
class SongFilter; class SongFilter;
gcc_nonnull(3)
void void
PrintSongCount(Response &r, const Partition &partition, const char *name, PrintSongCount(Response &r, const Partition &partition, const char *name,
const SongFilter *filter, const SongFilter *filter,

View File

@ -4,14 +4,11 @@
#ifndef MPD_DATABASE_PLAYLIST_HXX #ifndef MPD_DATABASE_PLAYLIST_HXX
#define MPD_DATABASE_PLAYLIST_HXX #define MPD_DATABASE_PLAYLIST_HXX
#include "util/Compiler.h"
class Database; class Database;
class Storage; class Storage;
struct DatabaseSelection; struct DatabaseSelection;
class PlaylistFileEditor; class PlaylistFileEditor;
gcc_nonnull(3)
void void
search_add_to_playlist(const Database &db, const Storage *storage, search_add_to_playlist(const Database &db, const Storage *storage,
const char *playlist_path_utf8, const char *playlist_path_utf8,

View File

@ -21,7 +21,7 @@
#include <functional> #include <functional>
gcc_pure [[gnu::pure]]
static const char * static const char *
ApplyBaseFlag(const char *uri, bool base) noexcept ApplyBaseFlag(const char *uri, bool base) noexcept
{ {

View File

@ -12,7 +12,7 @@
#include <string.h> #include <string.h>
struct StringLess { struct StringLess {
gcc_pure [[gnu::pure]]
bool operator()(const char *a, const char *b) const noexcept { bool operator()(const char *a, const char *b) const noexcept {
return strcmp(a, b) < 0; return strcmp(a, b) < 0;
} }

View File

@ -16,7 +16,6 @@
#include "song/UriSongFilter.hxx" #include "song/UriSongFilter.hxx"
#include "song/BaseSongFilter.hxx" #include "song/BaseSongFilter.hxx"
#include "song/TagSongFilter.hxx" #include "song/TagSongFilter.hxx"
#include "util/Compiler.h"
#include "config/Block.hxx" #include "config/Block.hxx"
#include "tag/Builder.hxx" #include "tag/Builder.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
@ -265,7 +264,7 @@ ProxySong::ProxySong(const mpd_song *song)
tag_builder.Commit(tag2); tag_builder.Commit(tag2);
} }
gcc_const [[gnu::const]]
static enum mpd_tag_type static enum mpd_tag_type
Convert(TagType tag_type) noexcept Convert(TagType tag_type) noexcept
{ {
@ -694,7 +693,7 @@ Visit(struct mpd_connection *connection,
visit_directory, visit_song, visit_playlist); visit_directory, visit_song, visit_playlist);
} }
gcc_pure [[gnu::pure]]
static bool static bool
Match(const SongFilter *filter, const LightSong &song) noexcept Match(const SongFilter *filter, const LightSong &song) noexcept
{ {
@ -864,7 +863,7 @@ try {
throw; throw;
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsFilterSupported(const ISongFilter &f) noexcept IsFilterSupported(const ISongFilter &f) noexcept
{ {
@ -890,7 +889,7 @@ IsFilterSupported(const ISongFilter &f) noexcept
return false; return false;
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsFilterFullySupported(const SongFilter &filter, IsFilterFullySupported(const SongFilter &filter,
const struct mpd_connection *connection) noexcept const struct mpd_connection *connection) noexcept
@ -908,7 +907,7 @@ IsFilterFullySupported(const SongFilter &filter,
[](const auto &item) { return IsFilterSupported(*item); }); [](const auto &item) { return IsFilterSupported(*item); });
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsFilterFullySupported(const SongFilter *filter, IsFilterFullySupported(const SongFilter *filter,
const struct mpd_connection *connection) noexcept const struct mpd_connection *connection) noexcept
@ -917,7 +916,7 @@ IsFilterFullySupported(const SongFilter *filter,
IsFilterFullySupported(*filter, connection); IsFilterFullySupported(*filter, connection);
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsSortSupported(TagType tag_type, IsSortSupported(TagType tag_type,
const struct mpd_connection *connection) noexcept const struct mpd_connection *connection) noexcept
@ -939,7 +938,7 @@ IsSortSupported(TagType tag_type,
return Convert(tag_type) != MPD_TAG_COUNT; return Convert(tag_type) != MPD_TAG_COUNT;
} }
gcc_pure [[gnu::pure]]
static DatabaseSelection static DatabaseSelection
CheckSelection(DatabaseSelection selection, CheckSelection(DatabaseSelection selection,
struct mpd_connection *connection) noexcept struct mpd_connection *connection) noexcept

View File

@ -193,7 +193,7 @@ Directory::FindSong(std::string_view name_utf8) const noexcept
return nullptr; return nullptr;
} }
gcc_pure [[gnu::pure]]
static bool static bool
directory_cmp(const Directory &a, const Directory &b) noexcept directory_cmp(const Directory &a, const Directory &b) noexcept
{ {

View File

@ -25,7 +25,7 @@
#define DIRECTORY_BEGIN "begin: " #define DIRECTORY_BEGIN "begin: "
#define DIRECTORY_END "end: " #define DIRECTORY_END "end: "
gcc_const [[gnu::const]]
static const char * static const char *
DeviceToTypeString(unsigned device) noexcept DeviceToTypeString(unsigned device) noexcept
{ {
@ -44,7 +44,7 @@ DeviceToTypeString(unsigned device) noexcept
} }
} }
gcc_pure [[gnu::pure]]
static unsigned static unsigned
ParseTypeString(const char *type) noexcept ParseTypeString(const char *type) noexcept
{ {

View File

@ -248,7 +248,7 @@ SimpleDatabase::ReturnSong([[maybe_unused]] const LightSong *song) const noexcep
} }
} }
gcc_const [[gnu::const]]
static DatabaseSelection static DatabaseSelection
CheckSelection(DatabaseSelection selection) noexcept CheckSelection(DatabaseSelection selection) noexcept
{ {

View File

@ -47,7 +47,7 @@ Song::GetURI() const noexcept
/** /**
* Path name traversal of a #Directory. * Path name traversal of a #Directory.
*/ */
gcc_pure [[gnu::pure]]
static const Directory * static const Directory *
FindTargetDirectory(const Directory &base, std::string_view path) noexcept 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. * Path name traversal of a #Song.
*/ */
gcc_pure [[gnu::pure]]
static const Song * static const Song *
FindTargetSong(const Directory &_directory, std::string_view target) noexcept FindTargetSong(const Directory &_directory, std::string_view target) noexcept
{ {

View File

@ -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 */ /* Only used for sorting/searchin a songvec, not general purpose compares */
gcc_pure [[gnu::pure]]
static bool static bool
song_cmp(const Song &a, const Song &b) noexcept song_cmp(const Song &a, const Song &b) noexcept
{ {

View File

@ -563,7 +563,7 @@ UpnpDatabase::VisitServer(const ContentDirectoryService &server,
} }
} }
gcc_const [[gnu::const]]
static DatabaseSelection static DatabaseSelection
CheckSelection(DatabaseSelection selection) noexcept CheckSelection(DatabaseSelection selection) noexcept
{ {

View File

@ -14,7 +14,6 @@
#include "fs/FileInfo.hxx" #include "fs/FileInfo.hxx"
#include "fs/Traits.hxx" #include "fs/Traits.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include "Log.hxx" #include "Log.hxx"
#include <cassert> #include <cassert>
@ -61,10 +60,10 @@ struct WatchDirectory {
void LoadExcludeList(Path directory_path) noexcept; void LoadExcludeList(Path directory_path) noexcept;
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
unsigned GetDepth() const noexcept; unsigned GetDepth() const noexcept;
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
AllocatedPath GetUriFS() const noexcept; AllocatedPath GetUriFS() const noexcept;
}; };
@ -137,7 +136,7 @@ WatchDirectory::GetUriFS() const noexcept
} }
/* we don't look at "." / ".." nor files with newlines in their name */ /* we don't look at "." / ".." nor files with newlines in their name */
gcc_pure [[gnu::pure]]
static bool static bool
SkipFilename(Path name) noexcept SkipFilename(Path name) noexcept
{ {
@ -210,7 +209,7 @@ try {
LogError(std::current_exception()); LogError(std::current_exception());
} }
gcc_pure [[gnu::pure]]
unsigned unsigned
WatchDirectory::GetDepth() const noexcept WatchDirectory::GetDepth() const noexcept
{ {

View File

@ -7,7 +7,7 @@
#include "playlist/PlaylistRegistry.hxx" #include "playlist/PlaylistRegistry.hxx"
#include "fs/Traits.hxx" #include "fs/Traits.hxx"
gcc_pure [[gnu::pure]]
static bool static bool
HaveArchivePluginForFilename(const char *filename) noexcept HaveArchivePluginForFilename(const char *filename) noexcept
{ {
@ -21,7 +21,7 @@ HaveArchivePluginForFilename(const char *filename) noexcept
#endif #endif
} }
gcc_pure [[gnu::pure]]
static bool static bool
HaveContainerPluginForFilename(const char *filename) noexcept HaveContainerPluginForFilename(const char *filename) noexcept
{ {
@ -31,7 +31,7 @@ HaveContainerPluginForFilename(const char *filename) noexcept
decoder_plugins_supports_suffix(suffix); decoder_plugins_supports_suffix(suffix);
} }
gcc_pure [[gnu::pure]]
static bool static bool
HavePlaylistPluginForFilename(const char *filename) noexcept HavePlaylistPluginForFilename(const char *filename) noexcept
{ {

View File

@ -215,14 +215,14 @@ try {
} }
/* we don't look at files with newlines in their name */ /* we don't look at files with newlines in their name */
gcc_pure [[gnu::pure]]
static bool static bool
skip_path(const char *name_utf8) noexcept skip_path(const char *name_utf8) noexcept
{ {
return std::strchr(name_utf8, '\n') != nullptr; return std::strchr(name_utf8, '\n') != nullptr;
} }
gcc_pure [[gnu::pure]]
bool bool
UpdateWalk::SkipSymlink(const Directory *directory, UpdateWalk::SkipSymlink(const Directory *directory,
std::string_view utf8_name) const noexcept std::string_view utf8_name) const noexcept

View File

@ -148,7 +148,7 @@ decoder_file_decode(const DecoderPlugin &plugin,
return bridge.dc.state != DecoderState::START; return bridge.dc.state != DecoderState::START;
} }
gcc_pure [[gnu::pure]]
static bool static bool
decoder_check_plugin_mime(const DecoderPlugin &plugin, decoder_check_plugin_mime(const DecoderPlugin &plugin,
const InputStream &is) noexcept const InputStream &is) noexcept
@ -160,7 +160,7 @@ decoder_check_plugin_mime(const DecoderPlugin &plugin,
plugin.SupportsMimeType(GetMimeTypeBase(mime_type)); plugin.SupportsMimeType(GetMimeTypeBase(mime_type));
} }
gcc_pure [[gnu::pure]]
static bool static bool
decoder_check_plugin_suffix(const DecoderPlugin &plugin, decoder_check_plugin_suffix(const DecoderPlugin &plugin,
std::string_view suffix) noexcept std::string_view suffix) noexcept
@ -170,7 +170,7 @@ decoder_check_plugin_suffix(const DecoderPlugin &plugin,
return !suffix.empty() && plugin.SupportsSuffix(suffix); return !suffix.empty() && plugin.SupportsSuffix(suffix);
} }
gcc_pure [[gnu::pure]]
static bool static bool
decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is, decoder_check_plugin(const DecoderPlugin &plugin, const InputStream &is,
std::string_view suffix) noexcept std::string_view suffix) noexcept
@ -449,7 +449,7 @@ try {
* are only kept as a cache to be displayed by the client; they shall * are only kept as a cache to be displayed by the client; they shall
* not be sent to the output. * not be sent to the output.
*/ */
gcc_pure [[gnu::pure]]
static bool static bool
SongHasVolatileTags(const DetachedSong &song) noexcept SongHasVolatileTags(const DetachedSong &song) noexcept
{ {

View File

@ -48,7 +48,7 @@ struct AudioFileInputStream {
} }
}; };
gcc_pure [[gnu::pure]]
static SongTime static SongTime
audiofile_get_duration(AFfilehandle fh) noexcept audiofile_get_duration(AFfilehandle fh) noexcept
{ {
@ -124,7 +124,7 @@ setup_virtual_fops(AudioFileInputStream &afis) noexcept
return vf; return vf;
} }
gcc_const [[gnu::const]]
static SampleFormat static SampleFormat
audiofile_bits_to_sample_format(int bits) noexcept audiofile_bits_to_sample_format(int bits) noexcept
{ {

View File

@ -88,14 +88,14 @@ ffmpeg_finish() noexcept
av_dict_free(&avformat_options); av_dict_free(&avformat_options);
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsAudio(const AVStream &stream) noexcept IsAudio(const AVStream &stream) noexcept
{ {
return stream.codecpar->codec_type == AVMEDIA_TYPE_AUDIO; return stream.codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
} }
gcc_pure [[gnu::pure]]
static int static int
ffmpeg_find_audio_stream(const AVFormatContext &format_context) noexcept ffmpeg_find_audio_stream(const AVFormatContext &format_context) noexcept
{ {
@ -106,7 +106,7 @@ ffmpeg_find_audio_stream(const AVFormatContext &format_context) noexcept
return -1; return -1;
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsPicture(const AVStream &stream) noexcept 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 * Convert AVPacket::pts to a stream-relative time stamp (still in
* AVStream::time_base units). Returns a negative value on error. * AVStream::time_base units). Returns a negative value on error.
*/ */
gcc_pure [[gnu::pure]]
static int64_t static int64_t
StreamRelativePts(const AVPacket &packet, const AVStream &stream) noexcept 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 * Convert a non-negative stream-relative time stamp in
* AVStream::time_base units to a PCM frame number. * AVStream::time_base units to a PCM frame number.
*/ */
gcc_pure [[gnu::pure]]
static uint64_t static uint64_t
PtsToPcmFrame(uint64_t pts, const AVStream &stream, PtsToPcmFrame(uint64_t pts, const AVStream &stream,
const AVCodecContext &codec_context) noexcept const AVCodecContext &codec_context) noexcept
@ -323,7 +323,7 @@ ffmpeg_send_packet(DecoderClient &client, InputStream *is,
return cmd; return cmd;
} }
gcc_const [[gnu::const]]
static SampleFormat static SampleFormat
ffmpeg_sample_format(enum AVSampleFormat sample_fmt) noexcept ffmpeg_sample_format(enum AVSampleFormat sample_fmt) noexcept
{ {

View File

@ -61,7 +61,7 @@ gme_plugin_init([[maybe_unused]] const ConfigBlock &block)
return true; return true;
} }
gcc_pure [[gnu::pure]]
static unsigned static unsigned
ParseSubtuneName(const char *base) noexcept ParseSubtuneName(const char *base) noexcept
{ {

View File

@ -50,7 +50,7 @@ static constexpr unsigned DECODERDELAY = 529;
static constexpr Domain mad_domain("mad"); static constexpr Domain mad_domain("mad");
gcc_const [[gnu::const]]
static SongTime static SongTime
ToSongTime(mad_timer_t t) noexcept ToSongTime(mad_timer_t t) noexcept
{ {
@ -135,10 +135,10 @@ private:
void ParseId3(size_t tagsize, Tag *tag) noexcept; void ParseId3(size_t tagsize, Tag *tag) noexcept;
MadDecoderAction DecodeNextFrame(bool skip, Tag *tag) noexcept; MadDecoderAction DecodeNextFrame(bool skip, Tag *tag) noexcept;
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
offset_type ThisFrameOffset() const noexcept; offset_type ThisFrameOffset() const noexcept;
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
offset_type RestIncludingThisFrame() const noexcept; offset_type RestIncludingThisFrame() const noexcept;
/** /**
@ -157,7 +157,7 @@ private:
times = new mad_timer_t[max_frames]; times = new mad_timer_t[max_frames];
} }
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
size_t TimeToFrame(SongTime t) const noexcept; size_t TimeToFrame(SongTime t) const noexcept;
/** /**

View File

@ -33,15 +33,15 @@ constexpr opus_int32 opus_sample_rate = 48000;
*/ */
constexpr unsigned opus_output_buffer_frames = opus_sample_rate / 4; constexpr unsigned opus_output_buffer_frames = opus_sample_rate / 4;
gcc_pure [[gnu::pure]]
bool static bool
IsOpusHead(const ogg_packet &packet) noexcept IsOpusHead(const ogg_packet &packet) noexcept
{ {
return packet.bytes >= 8 && memcmp(packet.packet, "OpusHead", 8) == 0; return packet.bytes >= 8 && memcmp(packet.packet, "OpusHead", 8) == 0;
} }
gcc_pure [[gnu::pure]]
bool static bool
IsOpusTags(const ogg_packet &packet) noexcept IsOpusTags(const ogg_packet &packet) noexcept
{ {
return packet.bytes >= 8 && memcmp(packet.packet, "OpusTags", 8) == 0; 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. * Convert an EBU R128 value to ReplayGain.
*/ */
constexpr float static constexpr float
EbuR128ToReplayGain(float ebu_r128) noexcept EbuR128ToReplayGain(float ebu_r128) noexcept
{ {
/* add 5dB to compensate for the different reference levels /* add 5dB to compensate for the different reference levels
@ -58,7 +58,7 @@ EbuR128ToReplayGain(float ebu_r128) noexcept
return ebu_r128 + 5; return ebu_r128 + 5;
} }
bool static bool
mpd_opus_init([[maybe_unused]] const ConfigBlock &block) mpd_opus_init([[maybe_unused]] const ConfigBlock &block)
{ {
LogDebug(opus_domain, opus_get_version_string()); LogDebug(opus_domain, opus_get_version_string());
@ -300,7 +300,7 @@ MPDOpusDecoder::HandleAudio(const ogg_packet &packet)
packet.bytes, packet.bytes,
output_buffer, opus_output_buffer_frames, output_buffer, opus_output_buffer_frames,
0); 0);
if (gcc_unlikely(nframes <= 0)) { if (nframes <= 0) [[unlikely]] {
if (nframes < 0) if (nframes < 0)
throw FmtRuntimeError("libopus error: {}", throw FmtRuntimeError("libopus error: {}",
opus_strerror(nframes)); opus_strerror(nframes));

View File

@ -17,7 +17,7 @@
using std::string_view_literals::operator""sv; using std::string_view_literals::operator""sv;
gcc_pure [[gnu::pure]]
static TagType static TagType
ParseOpusTagName(std::string_view name) noexcept ParseOpusTagName(std::string_view name) noexcept
{ {

View File

@ -149,7 +149,7 @@ struct SidplayContainerPath {
unsigned track; unsigned track;
}; };
gcc_pure [[gnu::pure]]
static unsigned static unsigned
ParseSubtuneName(const char *base) noexcept ParseSubtuneName(const char *base) noexcept
{ {
@ -458,7 +458,7 @@ Windows1252ToUTF8(const char *s) noexcept
return t; return t;
} }
gcc_pure [[gnu::pure]]
static AllocatedString static AllocatedString
GetInfoString(const SidTuneInfo &info, unsigned i) noexcept GetInfoString(const SidTuneInfo &info, unsigned i) noexcept
{ {
@ -475,7 +475,7 @@ GetInfoString(const SidTuneInfo &info, unsigned i) noexcept
return Windows1252ToUTF8(s); return Windows1252ToUTF8(s);
} }
gcc_pure [[gnu::pure]]
static AllocatedString static AllocatedString
GetDateString(const SidTuneInfo &info) noexcept GetDateString(const SidTuneInfo &info) noexcept
{ {

View File

@ -128,7 +128,7 @@ sndfile_duration(const SF_INFO &info)
return SongTime::FromScale<uint64_t>(info.frames, info.samplerate); return SongTime::FromScale<uint64_t>(info.frames, info.samplerate);
} }
gcc_pure [[gnu::pure]]
static SampleFormat static SampleFormat
sndfile_sample_format(const SF_INFO &info) noexcept sndfile_sample_format(const SF_INFO &info) noexcept
{ {

View File

@ -3,7 +3,6 @@
#include "BufferedSocket.hxx" #include "BufferedSocket.hxx"
#include "net/SocketError.hxx" #include "net/SocketError.hxx"
#include "util/Compiler.h"
#include <stdexcept> #include <stdexcept>
@ -11,7 +10,7 @@ BufferedSocket::ssize_t
BufferedSocket::DirectRead(void *data, size_t length) noexcept BufferedSocket::DirectRead(void *data, size_t length) noexcept
{ {
const auto nbytes = GetSocket().Read((char *)data, length); const auto nbytes = GetSocket().Read((char *)data, length);
if (gcc_likely(nbytes > 0)) if (nbytes > 0) [[likely]]
return nbytes; return nbytes;
if (nbytes == 0) { if (nbytes == 0) {
@ -86,7 +85,7 @@ BufferedSocket::OnSocketReady(unsigned flags) noexcept
{ {
assert(IsDefined()); assert(IsDefined());
if (gcc_unlikely(flags & (SocketEvent::ERROR|SocketEvent::HANGUP))) { if (flags & (SocketEvent::ERROR|SocketEvent::HANGUP)) [[unlikely]] {
OnSocketClosed(); OnSocketClosed();
return; return;
} }

View File

@ -3,7 +3,6 @@
#include "FullyBufferedSocket.hxx" #include "FullyBufferedSocket.hxx"
#include "net/SocketError.hxx" #include "net/SocketError.hxx"
#include "util/Compiler.h"
#include <cassert> #include <cassert>
@ -13,7 +12,7 @@ FullyBufferedSocket::ssize_t
FullyBufferedSocket::DirectWrite(const void *data, size_t length) noexcept FullyBufferedSocket::DirectWrite(const void *data, size_t length) noexcept
{ {
const auto nbytes = GetSocket().Write((const char *)data, length); const auto nbytes = GetSocket().Write((const char *)data, length);
if (gcc_unlikely(nbytes < 0)) { if (nbytes < 0) [[unlikely]] {
const auto code = GetSocketError(); const auto code = GetSocketError();
if (IsSocketErrorSendWouldBlock(code)) if (IsSocketErrorSendWouldBlock(code))
return 0; return 0;
@ -43,7 +42,7 @@ FullyBufferedSocket::Flush() noexcept
} }
auto nbytes = DirectWrite(data.data(), data.size()); auto nbytes = DirectWrite(data.data(), data.size());
if (gcc_unlikely(nbytes <= 0)) if (nbytes <= 0) [[unlikely]]
return nbytes == 0; return nbytes == 0;
output.Consume(nbytes); output.Consume(nbytes);

View File

@ -12,7 +12,7 @@
static constexpr const char *hdcd_graph = "hdcd"; static constexpr const char *hdcd_graph = "hdcd";
gcc_pure [[gnu::pure]]
static bool static bool
MaybeHdcd(const AudioFormat &audio_format) noexcept MaybeHdcd(const AudioFormat &audio_format) noexcept
{ {

View File

@ -12,7 +12,6 @@
#include "filter/FilterPlugin.hxx" #include "filter/FilterPlugin.hxx"
#include "filter/NullFilter.hxx" #include "filter/NullFilter.hxx"
#include "filter/Prepared.hxx" #include "filter/Prepared.hxx"
#include "util/Compiler.h"
class PreparedNullFilter final : public PreparedFilter { class PreparedNullFilter final : public PreparedFilter {
public: public:

View File

@ -5,7 +5,7 @@
#include "FileInfo.hxx" #include "FileInfo.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
gcc_pure [[gnu::pure]]
static PathTraitsFS::pointer static PathTraitsFS::pointer
FindSlash(PathTraitsFS::pointer p, size_t i) noexcept FindSlash(PathTraitsFS::pointer p, size_t i) noexcept
{ {

View File

@ -36,7 +36,7 @@ InputStream::SetReady() noexcept
* seeking in a HTTP file requires opening a new connection with a new * seeking in a HTTP file requires opening a new connection with a new
* HTTP request. * HTTP request.
*/ */
gcc_pure [[gnu::pure]]
static bool static bool
ExpensiveSeeking(const char *uri) noexcept ExpensiveSeeking(const char *uri) noexcept
{ {

View File

@ -67,7 +67,7 @@ BufferedOutputStream::Format(const char *fmt, ...)
std::size_t size = vsnprintf((char *)r.data(), r.size(), fmt, ap); std::size_t size = vsnprintf((char *)r.data(), r.size(), fmt, ap);
va_end(ap); va_end(ap);
if (gcc_unlikely(size >= r.size())) { if (size >= r.size()) [[unlikely]] {
/* buffer was not large enough; flush it and try /* buffer was not large enough; flush it and try
again */ again */
@ -75,7 +75,7 @@ BufferedOutputStream::Format(const char *fmt, ...)
r = buffer.Write(); r = buffer.Write();
if (gcc_unlikely(size >= r.size())) { if (size >= r.size()) [[unlikely]] {
/* still not enough space: grow the buffer and /* still not enough space: grow the buffer and
try again */ try again */
++size; ++size;

View File

@ -7,7 +7,6 @@
#include "ObjectManager.hxx" #include "ObjectManager.hxx"
#include "util/SpanCast.hxx" #include "util/SpanCast.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
#include "util/Compiler.h"
#include <functional> #include <functional>
#include <stdexcept> #include <stdexcept>
@ -15,7 +14,7 @@
namespace UDisks2 { namespace UDisks2 {
template<typename I> template<typename I>
gcc_pure [[gnu::pure]]
static const char * static const char *
CheckString(I &&i) noexcept CheckString(I &&i) noexcept
{ {
@ -26,7 +25,7 @@ CheckString(I &&i) noexcept
} }
template<typename I> template<typename I>
gcc_pure [[gnu::pure]]
static std::string_view static std::string_view
CheckRecursedByteArrayToString(I &&i) noexcept CheckRecursedByteArrayToString(I &&i) noexcept
{ {
@ -38,7 +37,7 @@ CheckRecursedByteArrayToString(I &&i) noexcept
} }
template<typename I> template<typename I>
gcc_pure [[gnu::pure]]
static std::string_view static std::string_view
CheckByteArrayToString(I &&i) noexcept CheckByteArrayToString(I &&i) noexcept
{ {
@ -49,7 +48,7 @@ CheckByteArrayToString(I &&i) noexcept
} }
template<typename I> template<typename I>
gcc_pure [[gnu::pure]]
static std::string_view static std::string_view
CheckByteArrayArrayFrontToString(I &&i) noexcept CheckByteArrayArrayFrontToString(I &&i) noexcept
{ {

View File

@ -7,7 +7,6 @@
#include "Lease.hxx" #include "Lease.hxx"
#include "Callback.hxx" #include "Callback.hxx"
#include "event/InjectEvent.hxx" #include "event/InjectEvent.hxx"
#include "util/Compiler.h"
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

View File

@ -4,7 +4,6 @@
#ifndef MPD_SQLITE_UTIL_HXX #ifndef MPD_SQLITE_UTIL_HXX
#define MPD_SQLITE_UTIL_HXX #define MPD_SQLITE_UTIL_HXX
#include "util/Compiler.h"
#include "Error.hxx" #include "Error.hxx"
#include <sqlite3.h> #include <sqlite3.h>

View File

@ -4,8 +4,6 @@
#ifndef MPD_UPNP_ACTION_HXX #ifndef MPD_UPNP_ACTION_HXX
#define MPD_UPNP_ACTION_HXX #define MPD_UPNP_ACTION_HXX
#include "util/Compiler.h"
#include <upnptools.h> #include <upnptools.h>
static constexpr unsigned static constexpr unsigned

View File

@ -3,7 +3,6 @@
#include "FlacIOHandle.hxx" #include "FlacIOHandle.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "util/Compiler.h"
#include "system/Error.hxx" #include "system/Error.hxx"
#include <cerrno> #include <cerrno>

View File

@ -4,8 +4,6 @@
#ifndef MPD_FLAC_METADATA_ITERATOR_HXX #ifndef MPD_FLAC_METADATA_ITERATOR_HXX
#define MPD_FLAC_METADATA_ITERATOR_HXX #define MPD_FLAC_METADATA_ITERATOR_HXX
#include "util/Compiler.h"
#include <FLAC/metadata.h> #include <FLAC/metadata.h>
class FlacMetadataIterator { class FlacMetadataIterator {
@ -31,7 +29,7 @@ public:
return ::FLAC__metadata_iterator_next(iterator); return ::FLAC__metadata_iterator_next(iterator);
} }
gcc_pure [[gnu::pure]]
FLAC__StreamMetadata *GetBlock() noexcept { FLAC__StreamMetadata *GetBlock() noexcept {
return ::FLAC__metadata_iterator_get_block(iterator); return ::FLAC__metadata_iterator_get_block(iterator);
} }

View File

@ -59,7 +59,7 @@ flac_scan_comments(const FLAC__StreamMetadata_VorbisComment *comment,
ScanVorbisComment(ToStringView(comment->comments[i]), handler); ScanVorbisComment(ToStringView(comment->comments[i]), handler);
} }
gcc_pure [[gnu::pure]]
static inline SongTime static inline SongTime
flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info) noexcept flac_duration(const FLAC__StreamMetadata_StreamInfo *stream_info) noexcept
{ {

View File

@ -16,7 +16,7 @@
static constexpr Domain mixer_domain("mixer"); static constexpr Domain mixer_domain("mixer");
gcc_pure [[gnu::pure]]
static int static int
output_mixer_get_volume(const AudioOutputControl &ao) noexcept output_mixer_get_volume(const AudioOutputControl &ao) noexcept
{ {

View File

@ -228,7 +228,7 @@ AlsaMixer::~AlsaMixer()
snd_config_update_free_global(); snd_config_update_free_global();
} }
gcc_pure [[gnu::pure]]
static snd_mixer_elem_t * static snd_mixer_elem_t *
alsa_mixer_lookup_elem(snd_mixer_t *handle, alsa_mixer_lookup_elem(snd_mixer_t *handle,
const char *name, unsigned idx) noexcept const char *name, unsigned idx) noexcept

View File

@ -48,7 +48,7 @@ software_mixer_init([[maybe_unused]] EventLoop &event_loop,
return new SoftwareMixer(listener); return new SoftwareMixer(listener);
} }
gcc_const [[gnu::const]]
static unsigned static unsigned
PercentVolumeToSoftwareVolume(unsigned volume) noexcept PercentVolumeToSoftwareVolume(unsigned volume) noexcept
{ {

View File

@ -146,13 +146,13 @@ public:
/** /**
* Does the plugin support enabling/disabling a device? * Does the plugin support enabling/disabling a device?
*/ */
gcc_pure [[gnu::pure]]
bool SupportsEnableDisable() const noexcept; bool SupportsEnableDisable() const noexcept;
/** /**
* Does the plugin support pausing a device? * Does the plugin support pausing a device?
*/ */
gcc_pure [[gnu::pure]]
bool SupportsPause() const noexcept; bool SupportsPause() const noexcept;
std::map<std::string, std::string> GetAttributes() const noexcept; std::map<std::string, std::string> GetAttributes() const noexcept;
@ -204,7 +204,7 @@ public:
void Interrupt() noexcept; void Interrupt() noexcept;
gcc_pure [[gnu::pure]]
std::chrono::steady_clock::duration Delay() noexcept; std::chrono::steady_clock::duration Delay() noexcept;
void SendTag(const Tag &tag); void SendTag(const Tag &tag);

View File

@ -2,7 +2,6 @@
// Copyright The Music Player Daemon Project // Copyright The Music Player Daemon Project
#include "Interface.hxx" #include "Interface.hxx"
#include "util/Compiler.h"
#include <stdexcept> #include <stdexcept>

View File

@ -4,8 +4,6 @@
#ifndef MPD_OUTPUT_PLUGIN_HXX #ifndef MPD_OUTPUT_PLUGIN_HXX
#define MPD_OUTPUT_PLUGIN_HXX #define MPD_OUTPUT_PLUGIN_HXX
#include "util/Compiler.h"
struct ConfigBlock; struct ConfigBlock;
class AudioOutput; class AudioOutput;
struct MixerPlugin; struct MixerPlugin;
@ -54,7 +52,7 @@ ao_plugin_test_default_device(const AudioOutputPlugin *plugin)
: false; : false;
} }
gcc_malloc gcc_returns_nonnull [[gnu::malloc]] [[gnu::returns_nonnull]]
AudioOutput * AudioOutput *
ao_plugin_init(EventLoop &event_loop, ao_plugin_init(EventLoop &event_loop,
const AudioOutputPlugin &plugin, const AudioOutputPlugin &plugin,

View File

@ -4,8 +4,6 @@
#ifndef SHARED_PIPE_CONSUMER_HXX #ifndef SHARED_PIPE_CONSUMER_HXX
#define SHARED_PIPE_CONSUMER_HXX #define SHARED_PIPE_CONSUMER_HXX
#include "util/Compiler.h"
#include <cassert> #include <cassert>
struct MusicChunk; struct MusicChunk;
@ -67,7 +65,7 @@ public:
consumed = true; consumed = true;
} }
gcc_pure [[gnu::pure]]
bool IsConsumed(const MusicChunk &_chunk) const noexcept; bool IsConsumed(const MusicChunk &_chunk) const noexcept;
void ClearTail([[maybe_unused]] const MusicChunk &_chunk) noexcept { void ClearTail([[maybe_unused]] const MusicChunk &_chunk) noexcept {

View File

@ -246,7 +246,7 @@ public:
using MultiSocketMonitor::GetEventLoop; using MultiSocketMonitor::GetEventLoop;
gcc_pure [[gnu::pure]]
const char *GetDevice() const noexcept { const char *GetDevice() const noexcept {
return device.empty() ? default_device : device.c_str(); return device.empty() ? default_device : device.c_str();
} }
@ -292,13 +292,13 @@ private:
#endif #endif
); );
gcc_pure [[gnu::pure]]
bool LockIsActive() const noexcept { bool LockIsActive() const noexcept {
const std::scoped_lock<Mutex> lock(mutex); const std::scoped_lock<Mutex> lock(mutex);
return active; return active;
} }
gcc_pure [[gnu::pure]]
bool LockIsActiveAndNotWaiting() const noexcept { bool LockIsActiveAndNotWaiting() const noexcept {
const std::scoped_lock<Mutex> lock(mutex); const std::scoped_lock<Mutex> lock(mutex);
return active && !waiting; return active && !waiting;
@ -654,7 +654,7 @@ MaybeDmix(snd_pcm_type_t type)
return type == SND_PCM_TYPE_DMIX || type == SND_PCM_TYPE_PLUG; return type == SND_PCM_TYPE_DMIX || type == SND_PCM_TYPE_PLUG;
} }
gcc_pure [[gnu::pure]]
static bool static bool
MaybeDmix(snd_pcm_t *pcm) noexcept MaybeDmix(snd_pcm_t *pcm) noexcept
{ {

View File

@ -124,7 +124,7 @@ private:
* Determine the number of frames guaranteed to be available * Determine the number of frames guaranteed to be available
* on all channels. * on all channels.
*/ */
gcc_pure [[gnu::pure]]
jack_nframes_t GetAvailable() const noexcept; jack_nframes_t GetAvailable() const noexcept;
void Process(jack_nframes_t nframes); void Process(jack_nframes_t nframes);

View File

@ -525,7 +525,7 @@ osx_output_hog_device(AudioDeviceID dev_id, bool hog) noexcept
} }
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsAudioDeviceName(AudioDeviceID id, const char *expected_name) noexcept IsAudioDeviceName(AudioDeviceID id, const char *expected_name) noexcept
{ {

View File

@ -43,7 +43,7 @@ private:
void Open(AudioFormat &audio_format) override; void Open(AudioFormat &audio_format) override;
void Close() noexcept override; void Close() noexcept override;
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
std::chrono::steady_clock::duration Delay() const noexcept override { std::chrono::steady_clock::duration Delay() const noexcept override {
return filled < NUM_BUFFERS || HasProcessed() return filled < NUM_BUFFERS || HasProcessed()
? std::chrono::steady_clock::duration::zero() ? std::chrono::steady_clock::duration::zero()
@ -57,19 +57,19 @@ private:
void Cancel() noexcept override; void Cancel() noexcept override;
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
ALint GetSourceI(ALenum param) const noexcept { ALint GetSourceI(ALenum param) const noexcept {
ALint value; ALint value;
alGetSourcei(source, param, &value); alGetSourcei(source, param, &value);
return value; return value;
} }
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
bool HasProcessed() const noexcept { bool HasProcessed() const noexcept {
return GetSourceI(AL_BUFFERS_PROCESSED) > 0; return GetSourceI(AL_BUFFERS_PROCESSED) > 0;
} }
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
bool IsPlaying() const noexcept { bool IsPlaying() const noexcept {
return GetSourceI(AL_SOURCE_STATE) == AL_PLAYING; return GetSourceI(AL_SOURCE_STATE) == AL_PLAYING;
} }

View File

@ -372,8 +372,7 @@ oss_setup_sample_rate(FileDescriptor fd, AudioFormat &audio_format,
* Convert a MPD sample format to its OSS counterpart. Returns * Convert a MPD sample format to its OSS counterpart. Returns
* AFMT_QUERY if there is no direct counterpart. * AFMT_QUERY if there is no direct counterpart.
*/ */
gcc_const static constexpr int
static int
sample_format_to_oss(SampleFormat format) noexcept sample_format_to_oss(SampleFormat format) noexcept
{ {
switch (format) { switch (format) {
@ -411,8 +410,7 @@ sample_format_to_oss(SampleFormat format) noexcept
* Convert an OSS sample format to its MPD counterpart. Returns * Convert an OSS sample format to its MPD counterpart. Returns
* SampleFormat::UNDEFINED if there is no direct counterpart. * SampleFormat::UNDEFINED if there is no direct counterpart.
*/ */
gcc_const static constexpr SampleFormat
static SampleFormat
sample_format_from_oss(int format) noexcept sample_format_from_oss(int format) noexcept
{ {
switch (format) { switch (format) {

View File

@ -72,7 +72,7 @@ private:
std::size_t Play(std::span<const std::byte> src) override; std::size_t Play(std::span<const std::byte> src) override;
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
bool HasDynamicPath() const noexcept { bool HasDynamicPath() const noexcept {
return !format_path.empty(); return !format_path.empty();
} }

View File

@ -8,8 +8,6 @@
#ifdef ENABLE_WINMM_OUTPUT #ifdef ENABLE_WINMM_OUTPUT
#include "util/Compiler.h"
#include <windef.h> #include <windef.h>
#include <mmsystem.h> #include <mmsystem.h>
@ -17,7 +15,7 @@ class WinmmOutput;
extern const struct AudioOutputPlugin winmm_output_plugin; extern const struct AudioOutputPlugin winmm_output_plugin;
gcc_pure [[gnu::pure]]
HWAVEOUT HWAVEOUT
winmm_output_get_handle(WinmmOutput &output); winmm_output_get_handle(WinmmOutput &output);

View File

@ -153,7 +153,7 @@ HttpdClient::SendResponse() noexcept
} }
ssize_t nbytes = GetSocket().Write(response, strlen(response)); ssize_t nbytes = GetSocket().Write(response, strlen(response));
if (gcc_unlikely(nbytes < 0)) { if (nbytes < 0) [[unlikely]] {
const SocketErrorMessage msg; const SocketErrorMessage msg;
FmtWarning(httpd_output_domain, FmtWarning(httpd_output_domain,
"failed to write to client: {}", "failed to write to client: {}",

View File

@ -6,7 +6,6 @@
#include "Page.hxx" #include "Page.hxx"
#include "event/BufferedSocket.hxx" #include "event/BufferedSocket.hxx"
#include "util/Compiler.h"
#include "util/IntrusiveList.hxx" #include "util/IntrusiveList.hxx"
#include <cstddef> #include <cstddef>
@ -156,7 +155,7 @@ public:
*/ */
bool SendResponse() noexcept; bool SendResponse() noexcept;
gcc_pure [[gnu::pure]]
ssize_t GetBytesTillMetaData() const noexcept; ssize_t GetBytesTillMetaData() const noexcept;
ssize_t TryWritePage(const Page &page, size_t position) noexcept; ssize_t TryWritePage(const Page &page, size_t position) noexcept;

View File

@ -17,7 +17,6 @@
#include "event/ServerSocket.hxx" #include "event/ServerSocket.hxx"
#include "event/InjectEvent.hxx" #include "event/InjectEvent.hxx"
#include "util/Cast.hxx" #include "util/Cast.hxx"
#include "util/Compiler.h"
#include "util/IntrusiveList.hxx" #include "util/IntrusiveList.hxx"
#include <queue> #include <queue>
@ -173,7 +172,7 @@ public:
* *
* Caller must lock the mutex. * Caller must lock the mutex.
*/ */
gcc_pure [[gnu::pure]]
bool HasClients() const noexcept { bool HasClients() const noexcept {
return !clients.empty(); return !clients.empty();
} }
@ -181,7 +180,7 @@ public:
/** /**
* Check whether there is at least one client. * Check whether there is at least one client.
*/ */
gcc_pure [[gnu::pure]]
bool LockHasClients() const noexcept { bool LockHasClients() const noexcept {
const std::scoped_lock<Mutex> protect(mutex); const std::scoped_lock<Mutex> protect(mutex);
return HasClients(); return HasClients();
@ -205,7 +204,7 @@ public:
*/ */
void SendHeader(HttpdClient &client) const noexcept; void SendHeader(HttpdClient &client) const noexcept;
gcc_pure [[gnu::pure]]
std::chrono::steady_clock::duration Delay() const noexcept override; std::chrono::steady_clock::duration Delay() const noexcept override;
/** /**

View File

@ -4,8 +4,6 @@
#ifndef MPD_PCM_UTILS_H #ifndef MPD_PCM_UTILS_H
#define MPD_PCM_UTILS_H #define MPD_PCM_UTILS_H
#include "util/Compiler.h"
#include <cstdint> #include <cstdint>
#include <limits> #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::MIN >= limits::min(), "out of range");
static_assert(Traits::MAX <= limits::max(), "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); return T(Traits::MIN);
if (gcc_unlikely(x > Traits::MAX)) if (x > Traits::MAX) [[unlikely]]
return T(Traits::MAX); return T(Traits::MAX);
return T(x); return T(x);

View File

@ -5,7 +5,6 @@
#define MPD_PCM_MIX_HXX #define MPD_PCM_MIX_HXX
#include "SampleFormat.hxx" #include "SampleFormat.hxx"
#include "util/Compiler.h"
#include <cstddef> #include <cstddef>

View File

@ -43,8 +43,7 @@ ConstructS24(uint8_t low, uint8_t mid, uint8_t high) noexcept
/** /**
* Read a packed signed little-endian 24 bit integer. * Read a packed signed little-endian 24 bit integer.
*/ */
gcc_pure static constexpr int32_t
static int32_t
ReadS24LE(const uint8_t *src) noexcept ReadS24LE(const uint8_t *src) noexcept
{ {
return ConstructS24(src[0], src[1], src[2]); 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. * Read a packed signed big-endian 24 bit integer.
*/ */
gcc_pure static constexpr int32_t
static int32_t
ReadS24BE(const uint8_t *src) noexcept ReadS24BE(const uint8_t *src) noexcept
{ {
return ConstructS24(src[2], src[1], src[0]); 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. * Read a packed signed native-endian 24 bit integer.
*/ */
gcc_pure [[gnu::pure]]
static int32_t static int32_t
ReadS24(const uint8_t *src) noexcept ReadS24(const uint8_t *src) noexcept
{ {

View File

@ -4,8 +4,6 @@
#ifndef MPD_PCM_RESAMPLER_HXX #ifndef MPD_PCM_RESAMPLER_HXX
#define MPD_PCM_RESAMPLER_HXX #define MPD_PCM_RESAMPLER_HXX
#include "util/Compiler.h"
#include <cstddef> #include <cstddef>
#include <span> #include <span>

View File

@ -48,8 +48,7 @@ static constexpr struct {
{ SOXR_INVALID_RECIPE, nullptr } { SOXR_INVALID_RECIPE, nullptr }
}; };
gcc_const static constexpr const char *
static const char *
soxr_quality_name(unsigned long recipe) noexcept soxr_quality_name(unsigned long recipe) noexcept
{ {
for (const auto *i = soxr_quality_table;; ++i) { 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 static unsigned long
soxr_parse_quality(const char *quality) noexcept soxr_parse_quality(const char *quality) noexcept
{ {

View File

@ -22,7 +22,7 @@ CrossFadeSettings::CanCrossFadeSong(SignedSongTime total_time) const noexcept
duration < std::chrono::duration_cast<FloatDuration>(total_time); duration < std::chrono::duration_cast<FloatDuration>(total_time);
} }
gcc_pure [[gnu::pure]]
static FloatDuration static FloatDuration
mixramp_interpolate(const char *ramp_list, float required_db) noexcept mixramp_interpolate(const char *ramp_list, float required_db) noexcept
{ {

View File

@ -237,7 +237,7 @@ private:
* Note: this function does not check if the decoder is already * Note: this function does not check if the decoder is already
* finished. * finished.
*/ */
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
bool IsDecoderAtCurrentSong() const noexcept { bool IsDecoderAtCurrentSong() const noexcept {
assert(pipe != nullptr); assert(pipe != nullptr);
@ -249,7 +249,7 @@ private:
* decoding it, or has finished doing it), and the player hasn't * decoding it, or has finished doing it), and the player hasn't
* switched to that song yet. * switched to that song yet.
*/ */
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
bool IsDecoderAtNextSong() const noexcept { bool IsDecoderAtNextSong() const noexcept {
return dc.pipe != nullptr && !IsDecoderAtCurrentSong(); return dc.pipe != nullptr && !IsDecoderAtCurrentSong();
} }

View File

@ -6,7 +6,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>
@ -104,19 +103,19 @@ struct PlaylistPlugin {
/** /**
* Does the plugin announce the specified URI scheme? * Does the plugin announce the specified URI scheme?
*/ */
gcc_pure gcc_nonnull_all [[gnu::pure]]
bool SupportsScheme(std::string_view scheme) const noexcept; bool SupportsScheme(std::string_view scheme) 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;
}; };

View File

@ -5,7 +5,6 @@
#define MPD_PLAYLIST_STREAM_HXX #define MPD_PLAYLIST_STREAM_HXX
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "util/Compiler.h"
#include <memory> #include <memory>
@ -18,11 +17,10 @@ class Path;
* @param path the path of the playlist file * @param path the path of the playlist file
* @return a playlist, or nullptr on error * @return a playlist, or nullptr on error
*/ */
gcc_nonnull_all
std::unique_ptr<SongEnumerator> std::unique_ptr<SongEnumerator>
playlist_open_path(Path path, Mutex &mutex); playlist_open_path(Path path, Mutex &mutex);
gcc_nonnull_all [[gnu::nonnull]]
std::unique_ptr<SongEnumerator> std::unique_ptr<SongEnumerator>
playlist_open_remote(const char *uri, Mutex &mutex); playlist_open_remote(const char *uri, Mutex &mutex);

View File

@ -6,7 +6,6 @@
#include "song/DetachedSong.hxx" #include "song/DetachedSong.hxx"
#include "tag/Builder.hxx" #include "tag/Builder.hxx"
#include "util/Compiler.h"
#include <memory> #include <memory>
#include <string> #include <string>
@ -108,7 +107,7 @@ public:
std::unique_ptr<DetachedSong> Get() noexcept; std::unique_ptr<DetachedSong> Get() noexcept;
private: private:
gcc_pure [[gnu::pure]]
TagBuilder *GetCurrentTag() noexcept; TagBuilder *GetCurrentTag() noexcept;
/** /**

View File

@ -4,8 +4,6 @@
#ifndef MPD_ID_TABLE_HXX #ifndef MPD_ID_TABLE_HXX
#define MPD_ID_TABLE_HXX #define MPD_ID_TABLE_HXX
#include "util/Compiler.h"
#include <cassert> #include <cassert>
/** /**

View File

@ -96,17 +96,17 @@ struct playlist {
return queue.PositionToId(position); return queue.PositionToId(position);
} }
gcc_pure [[gnu::pure]]
int GetCurrentPosition() const noexcept; int GetCurrentPosition() const noexcept;
gcc_pure [[gnu::pure]]
int GetNextPosition() const noexcept; int GetNextPosition() const noexcept;
/** /**
* Returns the song object which is currently queued. Returns * Returns the song object which is currently queued. Returns
* none if there is none (yet?) or if MPD isn't playing. * none if there is none (yet?) or if MPD isn't playing.
*/ */
gcc_pure [[gnu::pure]]
const DetachedSong *GetQueuedSong() const noexcept; const DetachedSong *GetQueuedSong() const noexcept;
/** /**

View File

@ -4,7 +4,6 @@
#ifndef MPD_QUEUE_HXX #ifndef MPD_QUEUE_HXX
#define MPD_QUEUE_HXX #define MPD_QUEUE_HXX
#include "util/Compiler.h"
#include "IdTable.hxx" #include "IdTable.hxx"
#include "SingleMode.hxx" #include "SingleMode.hxx"
#include "ConsumeMode.hxx" #include "ConsumeMode.hxx"
@ -141,14 +140,14 @@ struct Queue {
return items[position].id; return items[position].id;
} }
gcc_pure [[gnu::pure]]
unsigned OrderToPosition(unsigned _order) const noexcept { unsigned OrderToPosition(unsigned _order) const noexcept {
assert(_order < length); assert(_order < length);
return order[_order]; return order[_order];
} }
gcc_pure [[gnu::pure]]
unsigned PositionToOrder(unsigned position) const noexcept { unsigned PositionToOrder(unsigned position) const noexcept {
assert(position < length); assert(position < length);
@ -160,7 +159,7 @@ struct Queue {
} }
} }
gcc_pure [[gnu::pure]]
uint8_t GetPriorityAtPosition(unsigned position) const noexcept { uint8_t GetPriorityAtPosition(unsigned position) const noexcept {
assert(position < length); assert(position < length);
@ -217,7 +216,7 @@ struct Queue {
* *
* @return the next order number, or -1 to stop playback * @return the next order number, or -1 to stop playback
*/ */
gcc_pure [[gnu::pure]]
int GetNextOrder(unsigned order) const noexcept; int GetNextOrder(unsigned order) const noexcept;
/** /**
@ -375,11 +374,11 @@ private:
* Find the first item that has this specified priority or * Find the first item that has this specified priority or
* higher. * higher.
*/ */
gcc_pure [[gnu::pure]]
unsigned FindPriorityOrder(unsigned start_order, uint8_t priority, unsigned FindPriorityOrder(unsigned start_order, uint8_t priority,
unsigned exclude_order) const noexcept; unsigned exclude_order) const noexcept;
gcc_pure [[gnu::pure]]
unsigned CountSamePriority(unsigned start_order, unsigned CountSamePriority(unsigned start_order,
uint8_t priority) const noexcept; uint8_t priority) const noexcept;
}; };

View File

@ -4,11 +4,9 @@
#ifndef MPD_SONG_ESCAPE_HXX #ifndef MPD_SONG_ESCAPE_HXX
#define MPD_SONG_ESCAPE_HXX #define MPD_SONG_ESCAPE_HXX
#include "util/Compiler.h"
#include <string> #include <string>
gcc_pure [[gnu::pure]]
std::string std::string
EscapeFilterString(const std::string &src) noexcept; EscapeFilterString(const std::string &src) noexcept;

View File

@ -45,7 +45,7 @@ enum {
/** /**
* @return #TAG_NUM_OF_ITEM_TYPES on error * @return #TAG_NUM_OF_ITEM_TYPES on error
*/ */
gcc_pure [[gnu::pure]]
static unsigned static unsigned
locate_parse_type(const char *str) noexcept locate_parse_type(const char *str) noexcept
{ {

View File

@ -4,8 +4,6 @@
#ifndef MPD_STORAGE_REGISTRY_HXX #ifndef MPD_STORAGE_REGISTRY_HXX
#define MPD_STORAGE_REGISTRY_HXX #define MPD_STORAGE_REGISTRY_HXX
#include "util/Compiler.h"
#include <memory> #include <memory>
struct StoragePlugin; struct StoragePlugin;
@ -18,15 +16,15 @@ class EventLoop;
*/ */
extern const StoragePlugin *const storage_plugins[]; extern const StoragePlugin *const storage_plugins[];
gcc_nonnull_all gcc_pure [[gnu::nonnull]] [[gnu::pure]]
const StoragePlugin * const StoragePlugin *
GetStoragePluginByName(const char *name) noexcept; GetStoragePluginByName(const char *name) noexcept;
gcc_nonnull_all gcc_pure [[gnu::nonnull]] [[gnu::pure]]
const StoragePlugin * const StoragePlugin *
GetStoragePluginByUri(const char *uri) noexcept; GetStoragePluginByUri(const char *uri) noexcept;
gcc_nonnull_all [[gnu::nonnull]]
std::unique_ptr<Storage> std::unique_ptr<Storage>
CreateStorageURI(EventLoop &event_loop, const char *uri); CreateStorageURI(EventLoop &event_loop, const char *uri);

View File

@ -203,7 +203,7 @@ ParseU64(const char *s, size_t length) noexcept
return ParseU64(std::string(s, length).c_str()); return ParseU64(std::string(s, length).c_str());
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsXmlContentType(const char *content_type) noexcept IsXmlContentType(const char *content_type) noexcept
{ {
@ -211,7 +211,7 @@ IsXmlContentType(const char *content_type) noexcept
StringStartsWith(content_type, "application/xml"); StringStartsWith(content_type, "application/xml");
} }
gcc_pure [[gnu::pure]]
static bool static bool
IsXmlContentType(const Curl::Headers &headers) noexcept 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(); return HttpGetInfoOperation(*curl, uri.c_str()).Perform();
} }
gcc_pure [[gnu::pure]]
static std::string_view static std::string_view
UriPathOrSlash(const char *uri) noexcept UriPathOrSlash(const char *uri) noexcept
{ {
@ -494,7 +494,7 @@ private:
* Convert a "href" attribute (which may be an absolute URI) * Convert a "href" attribute (which may be an absolute URI)
* to the base file name. * to the base file name.
*/ */
gcc_pure [[gnu::pure]]
std::string_view HrefToEscapedName(const char *href) const noexcept { std::string_view HrefToEscapedName(const char *href) const noexcept {
std::string_view path = uri_get_path(href); std::string_view path = uri_get_path(href);
if (path.data() == nullptr) if (path.data() == nullptr)

View File

@ -4,8 +4,6 @@
#ifndef MPD_STORAGE_LOCAL_HXX #ifndef MPD_STORAGE_LOCAL_HXX
#define MPD_STORAGE_LOCAL_HXX #define MPD_STORAGE_LOCAL_HXX
#include "util/Compiler.h"
#include <memory> #include <memory>
struct StoragePlugin; struct StoragePlugin;
@ -14,7 +12,6 @@ class Path;
extern const StoragePlugin local_storage_plugin; extern const StoragePlugin local_storage_plugin;
gcc_nonnull_all
std::unique_ptr<Storage> std::unique_ptr<Storage>
CreateLocalStorage(Path base_fs); CreateLocalStorage(Path base_fs);

View File

@ -288,7 +288,7 @@ NfsStorage::GetInfo(std::string_view uri_utf8, bool follow)
return operation.GetInfo(); return operation.GetInfo();
} }
gcc_pure [[gnu::pure]]
static bool static bool
SkipNameFS(PathTraitsFS::const_pointer name) noexcept SkipNameFS(PathTraitsFS::const_pointer name) noexcept
{ {

View File

@ -133,7 +133,7 @@ SmbclientStorage::OpenDirectory(std::string_view uri_utf8)
handle); handle);
} }
gcc_pure [[gnu::pure]]
static bool static bool
SkipNameFS(PathTraitsFS::const_pointer name) noexcept SkipNameFS(PathTraitsFS::const_pointer name) noexcept
{ {

View File

@ -5,7 +5,6 @@
#define MPD_TAG_HANDLER_HXX #define MPD_TAG_HANDLER_HXX
#include "Chrono.hxx" #include "Chrono.hxx"
#include "util/Compiler.h"
#include <cstddef> #include <cstddef>
#include <cstdint> #include <cstdint>

View File

@ -55,7 +55,7 @@
#define ID3_FRAME_MOOD "TMOO" #define ID3_FRAME_MOOD "TMOO"
#endif #endif
gcc_pure [[gnu::pure]]
static Id3String static Id3String
tag_id3_getstring(const struct id3_frame *frame, unsigned i) noexcept 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. * 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. * Returns TAG_NUM_OF_ITEM_TYPES if the TXXX name is not understood.
*/ */
gcc_pure [[gnu::pure]]
static TagType static TagType
tag_id3_parse_txxx_name(const char *name) noexcept tag_id3_parse_txxx_name(const char *name) noexcept
{ {

View File

@ -43,7 +43,7 @@ ParseReplayGainTag(ReplayGainInfo &info,
const char *name; const char *name;
const char *value; const char *value;
gcc_pure [[gnu::pure]]
const char *operator[](const char *n) const noexcept { const char *operator[](const char *n) const noexcept {
return StringEqualsCaseASCII(name, n) return StringEqualsCaseASCII(name, n)
? value ? value
@ -60,7 +60,7 @@ ParseReplayGainVorbis(ReplayGainInfo &info, std::string_view entry) noexcept
struct VorbisCommentEntry { struct VorbisCommentEntry {
std::string_view entry; std::string_view entry;
gcc_pure [[gnu::pure]]
const char *operator[](std::string_view n) const noexcept { const char *operator[](std::string_view n) const noexcept {
return GetVorbisCommentValue(entry, n).data(); return GetVorbisCommentValue(entry, n).data();
} }

View File

@ -4,20 +4,21 @@
#ifndef CLAMP_HPP #ifndef CLAMP_HPP
#define CLAMP_HPP #define CLAMP_HPP
#include "Compiler.h"
/** /**
* Clamps the specified value in a range. Returns #min or #max if the * Clamps the specified value in a range. Returns #min or #max if the
* value is outside. * value is outside.
*/ */
template<typename T> template<typename T>
constexpr const 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) if (value < min) [[unlikely]]
? min return min;
: (gcc_unlikely(value > max)
? max : value); if (value > max) [[unlikely]]
return max;
return value;
} }
#endif #endif

View File

@ -4,8 +4,6 @@
#ifndef REUSABLE_ARRAY_HXX #ifndef REUSABLE_ARRAY_HXX
#define REUSABLE_ARRAY_HXX #define REUSABLE_ARRAY_HXX
#include "Compiler.h"
#include <cstddef> #include <cstddef>
#include <utility> #include <utility>
@ -59,7 +57,7 @@ public:
*/ */
[[gnu::malloc]] [[gnu::returns_nonnull]] [[gnu::malloc]] [[gnu::returns_nonnull]]
T *Get(size_t size) { T *Get(size_t size) {
if (gcc_unlikely(size > capacity)) { if (size > capacity) [[unlikely]] {
/* too small: grow */ /* too small: grow */
delete[] buffer; delete[] buffer;

View File

@ -2,7 +2,6 @@
// Copyright The Music Player Daemon Project // Copyright The Music Player Daemon Project
#include "Serial.hxx" #include "Serial.hxx"
#include "Compiler.h"
#include <atomic> #include <atomic>
#include <chrono> #include <chrono>
@ -13,7 +12,7 @@ int
GenerateSerial() noexcept GenerateSerial() noexcept
{ {
unsigned serial = ++next_serial; unsigned serial = ++next_serial;
if (gcc_unlikely(serial < 16)) { if (serial < 16) [[unlikely]] {
/* first-time initialization: seed with a clock value, /* first-time initialization: seed with a clock value,
which is random enough for our use */ which is random enough for our use */

View File

@ -4,8 +4,6 @@
#ifndef STRING_UTIL_HXX #ifndef STRING_UTIL_HXX
#define STRING_UTIL_HXX #define STRING_UTIL_HXX
#include "Compiler.h"
#include <cstddef> #include <cstddef>
#include <string_view> #include <string_view>
@ -17,7 +15,7 @@
* case-insensitive for ASCII characters * case-insensitive for ASCII characters
* @return true if found * @return true if found
*/ */
gcc_pure [[gnu::pure]]
bool bool
StringArrayContainsCase(const char *const*haystack, StringArrayContainsCase(const char *const*haystack,
std::string_view needle) noexcept; std::string_view needle) noexcept;

View File

@ -2,6 +2,7 @@
// author: Max Kellermann <max.kellermann@gmail.com> // author: Max Kellermann <max.kellermann@gmail.com>
#include "TruncateString.hxx" #include "TruncateString.hxx"
#include "Compiler.h"
#include <algorithm> #include <algorithm>

View File

@ -4,8 +4,6 @@
#ifndef TRUNCATE_STRING_HXX #ifndef TRUNCATE_STRING_HXX
#define TRUNCATE_STRING_HXX #define TRUNCATE_STRING_HXX
#include "Compiler.h"
#include <cstddef> #include <cstddef>
/** /**
@ -16,7 +14,7 @@
* terminator) * terminator)
* @return a pointer to the null terminator * @return a pointer to the null terminator
*/ */
gcc_nonnull_all [[gnu::nonnull]]
char * char *
CopyTruncateString(char *dest, const char *src, size_t size) noexcept; CopyTruncateString(char *dest, const char *src, size_t size) noexcept;

View File

@ -272,9 +272,9 @@ Latin1ToUTF8(const char *gcc_restrict src, char *gcc_restrict buffer,
char * char *
UnicodeToUTF8(unsigned ch, char *q) noexcept UnicodeToUTF8(unsigned ch, char *q) noexcept
{ {
if (gcc_likely(ch < 0x80)) { if (ch < 0x80) [[likely]] {
*q++ = (char)ch; *q++ = (char)ch;
} else if (gcc_likely(ch < 0x800)) { } else if (ch < 0x800) [[likely]] {
*q++ = MakeLeading1(ch >> 6); *q++ = MakeLeading1(ch >> 6);
*q++ = MakeContinuation(ch); *q++ = MakeContinuation(ch);
} else if (ch < 0x10000) { } else if (ch < 0x10000) {

View File

@ -2,7 +2,6 @@
// Copyright The Music Player Daemon Project // Copyright The Music Player Daemon Project
#include "Main.hxx" #include "Main.hxx"
#include "util/Compiler.h"
#include "Instance.hxx" #include "Instance.hxx"
#include "system/Error.hxx" #include "system/Error.hxx"
#include "Log.hxx" #include "Log.hxx"

View File

@ -4,7 +4,6 @@
#include "Bonjour.hxx" #include "Bonjour.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "util/Compiler.h"
#include <dns_sd.h> #include <dns_sd.h>

View File

@ -8,7 +8,6 @@
#include "Listen.hxx" #include "Listen.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "Log.hxx" #include "Log.hxx"
#include "util/Compiler.h"
#ifdef HAVE_AVAHI #ifdef HAVE_AVAHI
#include "avahi/Helper.hxx" #include "avahi/Helper.hxx"

View File

@ -6,7 +6,6 @@
#include "input/InputStream.hxx" #include "input/InputStream.hxx"
#include "tag/Names.hxx" #include "tag/Names.hxx"
#include "util/StringBuffer.hxx" #include "util/StringBuffer.hxx"
#include "util/Compiler.h"
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>

View File

@ -3,7 +3,6 @@
#include "tag/Builder.hxx" #include "tag/Builder.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "util/Compiler.h"
inline void inline void
BuildTag([[maybe_unused]] TagBuilder &tag) noexcept BuildTag([[maybe_unused]] TagBuilder &tag) noexcept

View File

@ -1,5 +1,4 @@
#include "fs/LookupFile.hxx" #include "fs/LookupFile.hxx"
#include "util/Compiler.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>

Some files were not shown because too many files have changed in this diff Show More