*: add "noexcept" to many, many function prototypes

This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
This commit is contained in:
Max Kellermann
2017-05-08 14:44:49 +02:00
parent ac2e4e593d
commit 71f0ed8b74
272 changed files with 873 additions and 846 deletions

View File

@@ -46,7 +46,7 @@ nfs_set_base(const char *server, const char *export_name)
}
const char *
nfs_check_base(const char *server, const char *path)
nfs_check_base(const char *server, const char *path) noexcept
{
assert(server != nullptr);
assert(path != nullptr);

View File

@@ -41,6 +41,6 @@ nfs_set_base(const char *server, const char *export_name);
*/
gcc_pure
const char *
nfs_check_base(const char *server, const char *path);
nfs_check_base(const char *server, const char *path) noexcept;
#endif

View File

@@ -91,29 +91,29 @@ private:
};
gcc_pure
iterator Find(reference_type p) {
iterator Find(reference_type p) noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p));
}
gcc_pure
const_iterator Find(const_reference_type p) const {
const_iterator Find(const_reference_type p) const noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p));
}
gcc_pure
iterator Find(CT &c) {
iterator Find(CT &c) noexcept {
return list.iterator_to(c);
}
gcc_pure
const_iterator Find(const CT &c) const {
const_iterator Find(const CT &c) const noexcept {
return list.iterator_to(c);
}
public:
#ifndef NDEBUG
gcc_pure
bool IsEmpty() const {
bool IsEmpty() const noexcept {
for (const auto &c : list)
if (!c.IsCancelled())
return false;
@@ -123,7 +123,7 @@ public:
#endif
gcc_pure
bool Contains(const_reference_type p) const {
bool Contains(const_reference_type p) const noexcept {
return Find(p) != list.end();
}
@@ -151,7 +151,7 @@ public:
i->Cancel();
}
CT &Get(reference_type p) {
CT &Get(reference_type p) noexcept {
auto i = Find(p);
assert(i != list.end());

View File

@@ -135,7 +135,7 @@ class NfsConnection : SocketMonitor, TimeoutMonitor, DeferredMonitor {
public:
gcc_nonnull_all
NfsConnection(EventLoop &_loop,
const char *_server, const char *_export_name)
const char *_server, const char *_export_name) noexcept
:SocketMonitor(_loop), TimeoutMonitor(_loop),
DeferredMonitor(_loop),
server(_server), export_name(_export_name),

View File

@@ -50,7 +50,7 @@ nfs_finish()
}
NfsConnection &
nfs_get_connection(const char *server, const char *export_name)
nfs_get_connection(const char *server, const char *export_name) noexcept
{
assert(in_use > 0);
assert(io_thread_inside());

View File

@@ -33,6 +33,6 @@ nfs_finish();
gcc_pure
NfsConnection &
nfs_get_connection(const char *server, const char *export_name);
nfs_get_connection(const char *server, const char *export_name) noexcept;
#endif

View File

@@ -38,7 +38,7 @@ NfsManager::ManagedConnection::OnNfsConnectionError(std::exception_ptr &&e)
inline bool
NfsManager::Compare::operator()(const LookupKey a,
const ManagedConnection &b) const
const ManagedConnection &b) const noexcept
{
int result = strcmp(a.server, b.GetServer());
if (result != 0)
@@ -50,7 +50,7 @@ NfsManager::Compare::operator()(const LookupKey a,
inline bool
NfsManager::Compare::operator()(const ManagedConnection &a,
const LookupKey b) const
const LookupKey b) const noexcept
{
int result = strcmp(a.GetServer(), b.server);
if (result != 0)
@@ -62,7 +62,7 @@ NfsManager::Compare::operator()(const ManagedConnection &a,
inline bool
NfsManager::Compare::operator()(const ManagedConnection &a,
const ManagedConnection &b) const
const ManagedConnection &b) const noexcept
{
int result = strcmp(a.GetServer(), b.GetServer());
if (result != 0)
@@ -82,7 +82,7 @@ NfsManager::~NfsManager()
}
NfsConnection &
NfsManager::GetConnection(const char *server, const char *export_name)
NfsManager::GetConnection(const char *server, const char *export_name) noexcept
{
assert(server != nullptr);
assert(export_name != nullptr);

View File

@@ -59,15 +59,15 @@ class NfsManager final : IdleMonitor {
struct Compare {
gcc_pure
bool operator()(const LookupKey a,
const ManagedConnection &b) const;
const ManagedConnection &b) const noexcept;
gcc_pure
bool operator()(const ManagedConnection &a,
const LookupKey b) const;
const LookupKey b) const noexcept;
gcc_pure
bool operator()(const ManagedConnection &a,
const ManagedConnection &b) const;
const ManagedConnection &b) const noexcept;
};
/**
@@ -99,7 +99,7 @@ public:
gcc_pure
NfsConnection &GetConnection(const char *server,
const char *export_name);
const char *export_name) noexcept;
private:
void ScheduleDelete(ManagedConnection &c) {