use [[gnu::...]] attributes

This commit is contained in:
Max Kellermann
2023-03-06 15:57:36 +01:00
parent 3b9aab0684
commit 42f6a0441c
101 changed files with 167 additions and 234 deletions

View File

@@ -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: {}",

View File

@@ -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;

View File

@@ -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;
/**