util/PeakBuffer, ...: use [[gnu::]] attributes
This commit is contained in:
parent
ce88dee14d
commit
a742e1fc71
@ -41,7 +41,7 @@
|
||||
* Determine whether two strings are equal, ignoring case for ASCII
|
||||
* letters.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static inline bool
|
||||
StringEqualsCaseASCII(const char *a, const char *b) noexcept
|
||||
{
|
||||
@ -56,7 +56,7 @@ StringEqualsCaseASCII(const char *a, const char *b) noexcept
|
||||
return strcasecmp(a, b) == 0;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static inline bool
|
||||
StringEqualsCaseASCII(const char *a, const char *b, size_t n) noexcept
|
||||
{
|
||||
@ -71,7 +71,7 @@ StringEqualsCaseASCII(const char *a, const char *b, size_t n) noexcept
|
||||
return strncasecmp(a, b, n) == 0;
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static inline bool
|
||||
StringStartsWithCaseASCII(const char *haystack,
|
||||
std::string_view needle) noexcept
|
||||
@ -79,7 +79,7 @@ StringStartsWithCaseASCII(const char *haystack,
|
||||
return StringEqualsCaseASCII(haystack, needle.data(), needle.length());
|
||||
}
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
static inline const char *
|
||||
StringAfterPrefixCaseASCII(const char *haystack,
|
||||
std::string_view needle) noexcept
|
||||
|
@ -29,14 +29,15 @@ class AllocatedString;
|
||||
/**
|
||||
* Format into an #AllocatedString.
|
||||
*/
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
AllocatedString
|
||||
FormatStringV(const char *fmt, std::va_list args) noexcept;
|
||||
|
||||
/**
|
||||
* Format into an #AllocatedString.
|
||||
*/
|
||||
gcc_nonnull(1) gcc_printf(1,2)
|
||||
[[gnu::nonnull(1)]]
|
||||
gcc_printf(1,2)
|
||||
AllocatedString
|
||||
FormatString(const char *fmt, ...) noexcept;
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
*/
|
||||
|
||||
#include "HugeAllocator.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <new>
|
||||
|
||||
@ -44,7 +43,7 @@
|
||||
/**
|
||||
* Round up the parameter, make it page-aligned.
|
||||
*/
|
||||
gcc_const
|
||||
[[gnu::const]]
|
||||
static size_t
|
||||
AlignToPageSize(size_t size) noexcept
|
||||
{
|
||||
|
@ -20,8 +20,6 @@
|
||||
#ifndef MPD_PEAK_BUFFER_HXX
|
||||
#define MPD_PEAK_BUFFER_HXX
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
template<typename T> struct WritableBuffer;
|
||||
@ -59,10 +57,10 @@ public:
|
||||
return normal_size + peak_size;
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
bool empty() const noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
WritableBuffer<void> Read() const noexcept;
|
||||
|
||||
void Consume(std::size_t length) noexcept;
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
* Get the buffer, and guarantee a minimum size. This buffer
|
||||
* becomes invalid with the next Get() call.
|
||||
*/
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
[[gnu::malloc]] [[gnu::returns_nonnull]]
|
||||
T *Get(size_t size) {
|
||||
if (gcc_unlikely(size > capacity)) {
|
||||
/* too small: grow */
|
||||
|
@ -21,7 +21,6 @@
|
||||
#define MPD_SLICE_BUFFER_HXX
|
||||
|
||||
#include "HugeAllocator.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
|
@ -30,8 +30,6 @@
|
||||
#ifndef URI_QUERY_PARSER_HXX
|
||||
#define URI_QUERY_PARSER_HXX
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
struct StringView;
|
||||
|
||||
/**
|
||||
@ -41,7 +39,7 @@ struct StringView;
|
||||
* @return the raw value (pointing into the #query_string parameter)
|
||||
* or nullptr if the parameter does not exist
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
StringView
|
||||
UriFindRawQueryParameter(StringView query_string, StringView name) noexcept;
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "UriExtract.hxx"
|
||||
#include "StringAPI.hxx"
|
||||
#include "StringCompare.hxx"
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
|
@ -30,8 +30,6 @@
|
||||
#ifndef URI_RELATIVE_HXX
|
||||
#define URI_RELATIVE_HXX
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
@ -40,11 +38,11 @@
|
||||
* specified by #parent. If the strings are equal, the function
|
||||
* returns false.
|
||||
*/
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
bool
|
||||
uri_is_child(const char *parent, const char *child) noexcept;
|
||||
|
||||
gcc_pure gcc_nonnull_all
|
||||
[[gnu::pure]] [[gnu::nonnull]]
|
||||
bool
|
||||
uri_is_child_or_same(const char *parent, const char *child) noexcept;
|
||||
|
||||
@ -52,11 +50,11 @@ uri_is_child_or_same(const char *parent, const char *child) noexcept;
|
||||
* Translate the given URI in the context of #base. For example,
|
||||
* uri_apply_base("foo", "http://bar/a/")=="http://bar/a/foo".
|
||||
*/
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string
|
||||
uri_apply_base(std::string_view uri, std::string_view base) noexcept;
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
std::string
|
||||
uri_apply_relative(std::string_view relative_uri,
|
||||
std::string_view base_uri) noexcept;
|
||||
|
@ -70,7 +70,7 @@ uri_safe_local(const char *uri) noexcept
|
||||
}
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
[[gnu::pure]]
|
||||
static const char *
|
||||
SkipUriScheme(const char *uri) noexcept
|
||||
{
|
||||
|
@ -30,8 +30,6 @@
|
||||
#ifndef MPD_VAR_SIZE_HXX
|
||||
#define MPD_VAR_SIZE_HXX
|
||||
|
||||
#include "Compiler.h"
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <new>
|
||||
@ -49,7 +47,7 @@
|
||||
* #T
|
||||
*/
|
||||
template<class T, typename... Args>
|
||||
gcc_malloc gcc_returns_nonnull
|
||||
[[gnu::malloc]] [[gnu::returns_nonnull]]
|
||||
T *
|
||||
NewVarSize(size_t declared_tail_size, size_t real_tail_size, Args&&... args)
|
||||
{
|
||||
@ -71,7 +69,7 @@ NewVarSize(size_t declared_tail_size, size_t real_tail_size, Args&&... args)
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
gcc_nonnull_all
|
||||
[[gnu::nonnull]]
|
||||
void
|
||||
DeleteVarSize(T *instance)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user