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

@@ -25,7 +25,7 @@ AutoGunzipReader::AutoGunzipReader(Reader &_next) noexcept
AutoGunzipReader::~AutoGunzipReader() noexcept = default;
gcc_pure
[[gnu::pure]]
static bool
IsGzip(const uint8_t data[4]) noexcept
{

View File

@@ -30,7 +30,6 @@
#ifndef BUFFERED_READER_HXX
#define BUFFERED_READER_HXX
#include "util/Compiler.h"
#include "util/DynamicFifoBuffer.hxx"
#include <cstddef>
@@ -64,7 +63,7 @@ public:
bool Fill(bool need_more);
gcc_pure
[[gnu::pure]]
WritableBuffer<void> Read() const noexcept {
return buffer.Read().ToVoid();
}

View File

@@ -32,7 +32,6 @@
#include "OutputStream.hxx"
#include "fs/AllocatedPath.hxx"
#include "util/Compiler.h"
#ifndef _WIN32
#include "io/FileDescriptor.hxx"
@@ -133,7 +132,7 @@ public:
return path;
}
gcc_pure
[[gnu::pure]]
uint64_t Tell() const noexcept;
/* virtual methods from class OutputStream */

View File

@@ -32,7 +32,6 @@
#include "Reader.hxx"
#include "fs/AllocatedPath.hxx"
#include "util/Compiler.h"
#ifdef _WIN32
#include <fileapi.h>
@@ -94,7 +93,7 @@ public:
FileInfo GetFileInfo() const;
gcc_pure
[[gnu::pure]]
uint64_t GetSize() const noexcept {
#ifdef _WIN32
LARGE_INTEGER size;
@@ -106,7 +105,7 @@ public:
#endif
}
gcc_pure
[[gnu::pure]]
uint64_t GetPosition() const noexcept {
#ifdef _WIN32
LARGE_INTEGER zero;

View File

@@ -30,8 +30,6 @@
#ifndef READER_HXX
#define READER_HXX
#include "util/Compiler.h"
#include <cstddef>
/**
@@ -52,7 +50,7 @@ public:
* @return the number of bytes read into the given buffer or 0
* on end-of-stream
*/
gcc_nonnull_all
[[gnu::nonnull]]
virtual size_t Read(void *data, size_t size) = 0;
};