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

@@ -47,7 +47,7 @@ public:
ClockCache(const ClockCache &) = delete;
ClockCache &operator=(const ClockCache &) = delete;
gcc_pure
[[gnu::pure]]
const auto &now() const noexcept {
if (value <= value_type())
value = Clock::now();

View File

@@ -72,7 +72,7 @@ LocalTime(std::chrono::system_clock::time_point tp)
/**
* Determine the time zone offset in a portable way.
*/
gcc_const
[[gnu::const]]
static time_t
GetTimeZoneOffset() noexcept
{

View File

@@ -33,8 +33,6 @@
#ifndef TIME_CONVERT_HXX
#define TIME_CONVERT_HXX
#include "util/Compiler.h"
#include <chrono>
/**
@@ -56,18 +54,18 @@ LocalTime(std::chrono::system_clock::time_point tp);
/**
* Convert a UTC-based "struct tm" to a UTC-based time point.
*/
gcc_pure
[[gnu::pure]]
std::chrono::system_clock::time_point
TimeGm(struct tm &tm) noexcept;
/**
* Convert a local "struct tm" to a UTC-based time point.
*/
gcc_pure
[[gnu::pure]]
std::chrono::system_clock::time_point
MakeTime(struct tm &tm) noexcept;
gcc_pure
[[gnu::pure]]
std::chrono::steady_clock::duration
ToSteadyClockDuration(const struct timeval &tv) noexcept;

View File

@@ -33,8 +33,6 @@
#ifndef TIME_ISO8601_HXX
#define TIME_ISO8601_HXX
#include "util/Compiler.h"
#include <chrono>
#include <cstddef>
#include <utility>
@@ -42,11 +40,11 @@
struct tm;
template<size_t CAPACITY> class StringBuffer;
gcc_pure
[[gnu::pure]]
StringBuffer<64>
FormatISO8601(const struct tm &tm) noexcept;
gcc_pure
[[gnu::pure]]
StringBuffer<64>
FormatISO8601(std::chrono::system_clock::time_point tp);

View File

@@ -32,8 +32,6 @@
#pragma once
#include "util/Compiler.h"
#include <chrono>
struct tm;
@@ -42,7 +40,7 @@ struct tm;
* Calculates the preceding midnight time point in the current time
* zone.
*/
gcc_const
[[gnu::const]]
std::chrono::system_clock::time_point
PrecedingMidnightLocal(std::chrono::system_clock::time_point t) noexcept;