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 SYSTEM_ERROR_HXX
#define SYSTEM_ERROR_HXX
#include "util/Compiler.h"
#include <system_error> // IWYU pragma: export
#include <utility>
@@ -160,7 +158,7 @@ FormatFileNotFound(const char *fmt, Args&&... args) noexcept
#endif
}
gcc_pure
[[gnu::pure]]
inline bool
IsErrno(const std::system_error &e, int code) noexcept
{
@@ -168,7 +166,7 @@ IsErrno(const std::system_error &e, int code) noexcept
e.code().value() == code;
}
gcc_pure
[[gnu::pure]]
static inline bool
IsFileNotFound(const std::system_error &e) noexcept
{
@@ -180,7 +178,7 @@ IsFileNotFound(const std::system_error &e) noexcept
#endif
}
gcc_pure
[[gnu::pure]]
static inline bool
IsPathNotFound(const std::system_error &e) noexcept
{
@@ -192,7 +190,7 @@ IsPathNotFound(const std::system_error &e) noexcept
#endif
}
gcc_pure
[[gnu::pure]]
static inline bool
IsAccessDenied(const std::system_error &e) noexcept
{

View File

@@ -35,7 +35,7 @@
#include <sys/utsname.h>
#include <stdio.h>
gcc_const
[[gnu::const]]
static KernelVersionCode
GetKernelVersionCode() noexcept
{

View File

@@ -32,8 +32,6 @@
#pragma once
#include "util/Compiler.h"
class KernelVersionCode {
unsigned value = 0;
@@ -53,6 +51,6 @@ public:
/**
* Is the currently running Linux kernel at least the given version?
*/
gcc_const
[[gnu::const]]
bool
IsKernelVersionOrNewer(KernelVersionCode v) noexcept;