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

This commit is contained in:
Max Kellermann 2021-10-13 17:27:16 +02:00
parent 18f64b5fb7
commit 2fbbd540bb
5 changed files with 11 additions and 11 deletions

View File

@ -27,8 +27,7 @@
#include <system_error> #include <system_error>
gcc_const static constexpr enum ack
static enum ack
ToAck(PlaylistResult result) noexcept ToAck(PlaylistResult result) noexcept
{ {
switch (result) { switch (result) {
@ -63,8 +62,8 @@ ToAck(PlaylistResult result) noexcept
} }
#ifdef ENABLE_DATABASE #ifdef ENABLE_DATABASE
gcc_const
static enum ack static constexpr enum ack
ToAck(DatabaseErrorCode code) noexcept ToAck(DatabaseErrorCode code) noexcept
{ {
switch (code) { switch (code) {
@ -78,9 +77,10 @@ ToAck(DatabaseErrorCode code) noexcept
return ACK_ERROR_UNKNOWN; return ACK_ERROR_UNKNOWN;
} }
#endif #endif
gcc_pure [[gnu::pure]]
static enum ack static enum ack
ToAck(const std::exception_ptr& ep) noexcept ToAck(const std::exception_ptr& ep) noexcept
{ {

View File

@ -69,7 +69,7 @@ InotifyQueue::OnDelay() noexcept
} }
} }
gcc_pure [[gnu::pure]]
static bool static bool
path_in(const char *path, const char *possible_parent) noexcept path_in(const char *path, const char *possible_parent) noexcept
{ {

View File

@ -30,7 +30,7 @@ extern "C" {
#include <libavutil/log.h> #include <libavutil/log.h>
} }
gcc_const [[gnu::const]]
static LogLevel static LogLevel
FfmpegImportLogLevel(int level) noexcept FfmpegImportLogLevel(int level) noexcept
{ {

View File

@ -99,7 +99,7 @@ static constexpr char ContentDirectorySType[] = "urn:schemas-upnp-org:service:Co
// We don't include a version in comparisons, as we are satisfied with // We don't include a version in comparisons, as we are satisfied with
// version 1 // version 1
gcc_pure [[gnu::pure]]
static bool static bool
isCDService(const char *st) noexcept isCDService(const char *st) noexcept
{ {
@ -110,7 +110,7 @@ isCDService(const char *st) noexcept
// The type of device we're asking for in search // The type of device we're asking for in search
static constexpr char MediaServerDType[] = "urn:schemas-upnp-org:device:MediaServer:1"; static constexpr char MediaServerDType[] = "urn:schemas-upnp-org:device:MediaServer:1";
gcc_pure [[gnu::pure]]
static bool static bool
isMSDevice(const char *st) noexcept isMSDevice(const char *st) noexcept
{ {

View File

@ -40,12 +40,12 @@ class UpnpNeighborExplorer final
Server(const Server &) = delete; Server(const Server &) = delete;
Server &operator=(const Server &) = delete; Server &operator=(const Server &) = delete;
gcc_pure [[gnu::pure]]
bool operator==(const Server &other) const noexcept { bool operator==(const Server &other) const noexcept {
return name == other.name; return name == other.name;
} }
[[nodiscard]] gcc_pure [[nodiscard]] [[gnu::pure]]
NeighborInfo Export() const noexcept { NeighborInfo Export() const noexcept {
return { "smb://" + name + "/", comment }; return { "smb://" + name + "/", comment };
} }