use [[gnu::pure]] instead of gcc_pure

This is semi-standard and doesn't require the util/Compiler.h header.
This commit is contained in:
Max Kellermann
2021-02-08 14:59:40 +01:00
committed by Max Kellermann
parent 01af2778ab
commit 6cdb3ff21e
20 changed files with 61 additions and 80 deletions

View File

@@ -30,8 +30,6 @@
#ifndef FILE_DESCRIPTOR_HXX
#define FILE_DESCRIPTOR_HXX
#include "util/Compiler.h"
#include <cstddef>
#include <utility>
@@ -76,25 +74,25 @@ public:
/**
* Ask the kernel whether this is a valid file descriptor.
*/
gcc_pure
[[gnu::pure]]
bool IsValid() const noexcept;
/**
* Ask the kernel whether this is a regular file.
*/
gcc_pure
[[gnu::pure]]
bool IsRegularFile() const noexcept;
/**
* Ask the kernel whether this is a pipe.
*/
gcc_pure
[[gnu::pure]]
bool IsPipe() const noexcept;
/**
* Ask the kernel whether this is a socket descriptor.
*/
gcc_pure
[[gnu::pure]]
bool IsSocket() const noexcept;
#endif
@@ -219,7 +217,7 @@ public:
return lseek(Get(), offset, SEEK_CUR);
}
gcc_pure
[[gnu::pure]]
off_t Tell() const noexcept {
return lseek(Get(), 0, SEEK_CUR);
}
@@ -227,7 +225,7 @@ public:
/**
* Returns the size of the file in bytes, or -1 on error.
*/
gcc_pure
[[gnu::pure]]
off_t GetSize() const noexcept;
ssize_t Read(void *buffer, std::size_t length) noexcept {
@@ -256,7 +254,7 @@ public:
int WaitReadable(int timeout) const noexcept;
int WaitWritable(int timeout) const noexcept;
gcc_pure
[[gnu::pure]]
bool IsReadyForWriting() const noexcept;
#endif
};