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

@@ -21,7 +21,6 @@
#define PCM_BUFFER_HXX
#include "util/ReusableArray.hxx"
#include "util/Compiler.h"
#include <cstdint>
@@ -47,11 +46,11 @@ public:
* to signal "error". An empty destination buffer is not
* always an error.
*/
gcc_malloc gcc_returns_nonnull
[[gnu::malloc]] [[gnu::returns_nonnull]]
void *Get(size_t size) noexcept;
template<typename T>
gcc_malloc gcc_returns_nonnull
[[gnu::malloc]] [[gnu::returns_nonnull]]
T *GetT(size_t n) noexcept {
return (T *)Get(n * sizeof(T));
}

View File

@@ -73,7 +73,7 @@ public:
* @param src the input buffer
* @return the destination buffer
*/
gcc_pure
[[gnu::pure]]
ConstBuffer<void> Convert(ConstBuffer<void> src) noexcept;
};

View File

@@ -159,13 +159,13 @@ public:
* DSD_U32, four input bytes (= 4 * 8 bits) are combined to
* one output word (32 bits), dividing the sample rate by 4.
*/
gcc_pure
[[gnu::pure]]
unsigned CalcOutputSampleRate(unsigned input_sample_rate) const noexcept;
/**
* The inverse of CalcOutputSampleRate().
*/
gcc_pure
[[gnu::pure]]
unsigned CalcInputSampleRate(unsigned output_sample_rate) const noexcept;
};
@@ -198,7 +198,7 @@ public:
/**
* Calculate the size of one input frame.
*/
gcc_pure
[[gnu::pure]]
size_t GetInputFrameSize() const noexcept {
return channels * sample_format_size(src_sample_format);
}
@@ -206,19 +206,19 @@ public:
/**
* Calculate the size of one output frame.
*/
gcc_pure
[[gnu::pure]]
size_t GetOutputFrameSize() const noexcept;
/**
* @return the size of one input block in bytes
*/
gcc_pure
[[gnu::pure]]
size_t GetInputBlockSize() const noexcept;
/**
* @return the size of one output block in bytes
*/
gcc_pure
[[gnu::pure]]
size_t GetOutputBlockSize() const noexcept;
/**
@@ -243,7 +243,7 @@ public:
* destination buffer to the according number of bytes from the
* pcm_export() source buffer.
*/
gcc_pure
[[gnu::pure]]
size_t CalcInputSize(size_t dest_size) const noexcept;
};

View File

@@ -72,7 +72,7 @@ public:
* @param src the input buffer
* @return the destination buffer
*/
gcc_pure
[[gnu::pure]]
ConstBuffer<void> Convert(ConstBuffer<void> src) noexcept;
};

View File

@@ -37,7 +37,7 @@ class PcmDither;
* @param src the source PCM buffer
* @return the destination buffer
*/
gcc_pure
[[gnu::pure]]
ConstBuffer<int16_t>
pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither,
SampleFormat src_format, ConstBuffer<void> src) noexcept;
@@ -49,7 +49,7 @@ pcm_convert_to_16(PcmBuffer &buffer, PcmDither &dither,
* @param src the source PCM buffer
* @return the destination buffer
*/
gcc_pure
[[gnu::pure]]
ConstBuffer<int32_t>
pcm_convert_to_24(PcmBuffer &buffer,
SampleFormat src_format, ConstBuffer<void> src) noexcept;
@@ -61,7 +61,7 @@ pcm_convert_to_24(PcmBuffer &buffer,
* @param src the source PCM buffer
* @return the destination buffer
*/
gcc_pure
[[gnu::pure]]
ConstBuffer<int32_t>
pcm_convert_to_32(PcmBuffer &buffer,
SampleFormat src_format, ConstBuffer<void> src) noexcept;
@@ -73,7 +73,7 @@ pcm_convert_to_32(PcmBuffer &buffer,
* @param src the source PCM buffer
* @return the destination buffer
*/
gcc_pure
[[gnu::pure]]
ConstBuffer<float>
pcm_convert_to_float(PcmBuffer &buffer,
SampleFormat src_format, ConstBuffer<void> src) noexcept;

View File

@@ -120,7 +120,7 @@ public:
/**
* Apply the volume level.
*/
gcc_pure
[[gnu::pure]]
ConstBuffer<void> Apply(ConstBuffer<void> src) noexcept;
};