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

This commit is contained in:
Max Kellermann
2021-10-13 11:28:04 +02:00
parent 1c4b484a56
commit f510564d9d
135 changed files with 361 additions and 514 deletions

View File

@@ -132,7 +132,7 @@ public:
*
* Caller must lock the #DecoderControl object.
*/
gcc_pure
[[gnu::pure]]
bool CheckCancelRead() const noexcept;
/**

View File

@@ -23,7 +23,6 @@
#include "Command.hxx"
#include "Chrono.hxx"
#include "input/Ptr.hxx"
#include "util/Compiler.h"
#include <cstdint>
@@ -57,7 +56,7 @@ public:
* @return the current command, or DecoderCommand::NONE if there is no
* command pending
*/
gcc_pure
[[gnu::pure]]
virtual DecoderCommand GetCommand() noexcept = 0;
/**
@@ -72,7 +71,7 @@ public:
*
* @return the destination position for the seek
*/
gcc_pure
[[gnu::pure]]
virtual SongTime GetSeekTime() noexcept = 0;
/**
@@ -80,7 +79,7 @@ public:
*
* @return the destination position for the seek in frames
*/
gcc_pure
[[gnu::pure]]
virtual uint64_t GetSeekFrame() noexcept = 0;
/**

View File

@@ -229,7 +229,7 @@ public:
state == DecoderState::ERROR;
}
gcc_pure
[[gnu::pure]]
bool LockIsIdle() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return IsIdle();
@@ -239,7 +239,7 @@ public:
return state == DecoderState::START;
}
gcc_pure
[[gnu::pure]]
bool LockIsStarting() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return IsStarting();
@@ -251,7 +251,7 @@ public:
return state == DecoderState::ERROR;
}
gcc_pure
[[gnu::pure]]
bool LockHasFailed() const noexcept {
const std::lock_guard<Mutex> protect(mutex);
return HasFailed();
@@ -307,15 +307,15 @@ public:
*
* Caller must lock the object.
*/
gcc_pure
[[gnu::pure]]
bool IsCurrentSong(const DetachedSong &_song) const noexcept;
gcc_pure
[[gnu::pure]]
bool IsUnseekableCurrentSong(const DetachedSong &_song) const noexcept {
return !seekable && IsCurrentSong(_song);
}
gcc_pure
[[gnu::pure]]
bool IsSeekableCurrentSong(const DetachedSong &_song) const noexcept {
return seekable && IsCurrentSong(_song);
}

View File

@@ -20,7 +20,6 @@
#ifndef MPD_DECODER_BUFFER_HXX
#define MPD_DECODER_BUFFER_HXX
#include "util/Compiler.h"
#include "util/DynamicFifoBuffer.hxx"
#include "util/ConstBuffer.hxx"
@@ -74,7 +73,7 @@ public:
/**
* How many bytes are stored in the buffer?
*/
gcc_pure
[[gnu::pure]]
size_t GetAvailable() const noexcept {
return buffer.GetAvailable();
}

View File

@@ -20,8 +20,6 @@
#ifndef MPD_DECODER_LIST_HXX
#define MPD_DECODER_LIST_HXX
#include "util/Compiler.h"
#include <string_view>
struct ConfigData;
@@ -32,7 +30,7 @@ extern bool decoder_plugins_enabled[];
/* interface for using plugins */
gcc_pure
[[gnu::pure]]
const struct DecoderPlugin *
decoder_plugin_from_name(const char *name) noexcept;
@@ -98,7 +96,7 @@ decoder_plugins_for_each_enabled(F f)
* Is there at least once #DecoderPlugin that supports the specified
* file name suffix?
*/
gcc_pure gcc_nonnull_all
[[gnu::pure]]
bool
decoder_plugins_supports_suffix(std::string_view suffix) noexcept;

View File

@@ -20,8 +20,6 @@
#ifndef MPD_DECODER_PLUGIN_HXX
#define MPD_DECODER_PLUGIN_HXX
#include "util/Compiler.h"
#include <forward_list> // IWYU pragma: export
#include <set>
#include <string>
@@ -246,19 +244,19 @@ struct DecoderPlugin {
return container_scan(path, tnum);
}
gcc_pure
[[gnu::pure]]
bool SupportsUri(const char *uri) const noexcept;
/**
* Does the plugin announce the specified file name suffix?
*/
gcc_pure gcc_nonnull_all
[[gnu::pure]]
bool SupportsSuffix(std::string_view suffix) const noexcept;
/**
* Does the plugin announce the specified MIME type?
*/
gcc_pure gcc_nonnull_all
[[gnu::pure]]
bool SupportsMimeType(std::string_view mime_type) const noexcept;
bool SupportsContainerSuffix(std::string_view suffix) const noexcept {

View File

@@ -22,7 +22,6 @@
#include "util/ByteOrder.hxx"
#include "input/Offset.hxx"
#include "util/Compiler.h"
#include <cstdint>
@@ -33,7 +32,7 @@ class InputStream;
struct DsdId {
char value[4];
gcc_pure
[[gnu::pure]]
bool Equals(const char *s) const noexcept;
};
@@ -70,7 +69,7 @@ dsdlib_skip(DecoderClient *client, InputStream &is,
/**
* Check if the sample frequency is a valid DSD frequency.
**/
gcc_const
[[gnu::const]]
bool
dsdlib_valid_freq(uint32_t samplefreq) noexcept;