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

@@ -20,8 +20,6 @@
#ifndef MPD_FFMPEG_BUFFER_HXX
#define MPD_FFMPEG_BUFFER_HXX
#include "util/Compiler.h"
extern "C" {
#include <libavutil/mem.h>
}
@@ -42,7 +40,7 @@ public:
FfmpegBuffer(const FfmpegBuffer &) = delete;
FfmpegBuffer &operator=(const FfmpegBuffer &) = delete;
gcc_malloc
[[gnu::malloc]]
void *Get(size_t min_size) noexcept {
av_fast_malloc(&data, &size, min_size);
return data;

View File

@@ -20,7 +20,6 @@
#ifndef MPD_FFMPEG_IO_CONTEXT_HXX
#define MPD_FFMPEG_IO_CONTEXT_HXX
#include "util/Compiler.h"
#include "Error.hxx"
extern "C" {
@@ -65,12 +64,12 @@ public:
return io_context;
}
gcc_pure
[[gnu::pure]]
auto GetSize() const noexcept {
return avio_size(io_context);
}
gcc_pure
[[gnu::pure]]
bool IsEOF() const noexcept {
return avio_feof(io_context) != 0;
}

View File

@@ -21,7 +21,6 @@
#define MPD_FFMPEG_TIME_HXX
#include "Chrono.hxx"
#include "util/Compiler.h"
extern "C" {
#include <libavutil/avutil.h>
@@ -41,7 +40,7 @@ static constexpr AVRational AV_TIME_BASE_Q{1, AV_TIME_BASE};
/**
* Convert a FFmpeg time stamp to a floating point value (in seconds).
*/
gcc_const
[[gnu::const]]
static inline FloatDuration
FfmpegTimeToDouble(int64_t t, const AVRational time_base) noexcept
{
@@ -64,7 +63,7 @@ RatioToAVRational()
/**
* Convert a FFmpeg time stamp to a #SongTime.
*/
gcc_const
[[gnu::const]]
static inline SongTime
FromFfmpegTime(int64_t t, const AVRational time_base) noexcept
{
@@ -77,7 +76,7 @@ FromFfmpegTime(int64_t t, const AVRational time_base) noexcept
/**
* Convert a FFmpeg time stamp to a #SignedSongTime.
*/
gcc_const
[[gnu::const]]
static inline SignedSongTime
FromFfmpegTimeChecked(int64_t t, const AVRational time_base) noexcept
{
@@ -89,7 +88,7 @@ FromFfmpegTimeChecked(int64_t t, const AVRational time_base) noexcept
/**
* Convert a #SongTime to a FFmpeg time stamp with the given base.
*/
gcc_const
[[gnu::const]]
static inline int64_t
ToFfmpegTime(SongTime t, const AVRational time_base) noexcept
{
@@ -104,7 +103,7 @@ ToFfmpegTime(SongTime t, const AVRational time_base) noexcept
constexpr int64_t
FfmpegTimestampFallback(int64_t t, int64_t fallback)
{
return gcc_likely(t != int64_t(AV_NOPTS_VALUE))
return t != int64_t(AV_NOPTS_VALUE)
? t
: fallback;
}