use [[gnu::...]] attributes
This commit is contained in:
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user