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

@@ -20,8 +20,6 @@
#ifndef MPD_NFS_BASE_HXX
#define MPD_NFS_BASE_HXX
#include "util/Compiler.h"
/**
* Set the "base" NFS server and export name. This will be the
* default export that will be mounted if a file within this export is
@@ -38,7 +36,7 @@ nfs_set_base(const char *server, const char *export_name) noexcept;
* "path" after the export_name is returned; otherwise, nullptr is
* returned.
*/
gcc_pure
[[gnu::pure]]
const char *
nfs_check_base(const char *server, const char *path) noexcept;

View File

@@ -20,8 +20,6 @@
#ifndef MPD_NFS_CANCELLABLE_HXX
#define MPD_NFS_CANCELLABLE_HXX
#include "util/Compiler.h"
#include <boost/intrusive/list.hpp>
#include <algorithm>
@@ -89,35 +87,35 @@ private:
}
};
gcc_pure
[[gnu::pure]]
iterator Find(reference p) noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p));
}
gcc_pure
[[gnu::pure]]
const_iterator Find(const_reference p) const noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p));
}
gcc_pure
[[gnu::pure]]
iterator Find(CT &c) noexcept {
return list.iterator_to(c);
}
gcc_pure
[[gnu::pure]]
const_iterator Find(const CT &c) const noexcept {
return list.iterator_to(c);
}
public:
#ifndef NDEBUG
gcc_pure
[[gnu::pure]]
bool IsEmpty() const noexcept {
return std::all_of(list.begin(), list.end(), [](const auto &c) { return c.IsCancelled(); });
}
#endif
gcc_pure
[[gnu::pure]]
bool Contains(const_reference p) const noexcept {
return Find(p) != list.end();
}

View File

@@ -24,7 +24,6 @@
#include "event/SocketEvent.hxx"
#include "event/CoarseTimerEvent.hxx"
#include "event/DeferEvent.hxx"
#include "util/Compiler.h"
#include <string>
#include <list>
@@ -139,7 +138,7 @@ class NfsConnection {
bool mount_finished;
public:
gcc_nonnull_all
[[gnu::nonnull]]
NfsConnection(EventLoop &_loop,
const char *_server, const char *_export_name) noexcept
:socket_event(_loop, BIND_THIS_METHOD(OnSocketReady)),
@@ -157,12 +156,12 @@ public:
return socket_event.GetEventLoop();
}
gcc_pure
[[gnu::pure]]
const char *GetServer() const noexcept {
return server.c_str();
}
gcc_pure
[[gnu::pure]]
const char *GetExportName() const noexcept {
return export_name.c_str();
}

View File

@@ -20,8 +20,6 @@
#ifndef MPD_NFS_GLUE_HXX
#define MPD_NFS_GLUE_HXX
#include "util/Compiler.h"
class EventLoop;
class NfsConnection;
@@ -34,11 +32,11 @@ nfs_finish() noexcept;
/**
* Return the EventLoop that was passed to nfs_init().
*/
gcc_const
[[gnu::const]]
EventLoop &
nfs_get_event_loop() noexcept;
gcc_pure
[[gnu::pure]]
NfsConnection &
nfs_get_connection(const char *server, const char *export_name) noexcept;

View File

@@ -21,7 +21,6 @@
#define MPD_NFS_MANAGER_HXX
#include "Connection.hxx"
#include "util/Compiler.h"
#include "event/IdleEvent.hxx"
#include <boost/intrusive/set.hpp>
@@ -56,15 +55,15 @@ class NfsManager final {
};
struct Compare {
gcc_pure
[[gnu::pure]]
bool operator()(const LookupKey a,
const ManagedConnection &b) const noexcept;
gcc_pure
[[gnu::pure]]
bool operator()(const ManagedConnection &a,
const LookupKey b) const noexcept;
gcc_pure
[[gnu::pure]]
bool operator()(const ManagedConnection &a,
const ManagedConnection &b) const noexcept;
};
@@ -102,7 +101,7 @@ public:
return idle_event.GetEventLoop();
}
gcc_pure
[[gnu::pure]]
NfsConnection &GetConnection(const char *server,
const char *export_name) noexcept;