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_BIT_REVERSE_HXX
#define MPD_BIT_REVERSE_HXX
#include "Compiler.h"
#include <cstdint>
/**
@@ -43,7 +41,7 @@ struct BitReverseTable {
extern const BitReverseTable bit_reverse_table;
gcc_const
[[gnu::const]]
static inline uint8_t
bit_reverse(uint8_t x) noexcept
{

View File

@@ -32,7 +32,6 @@
#include "ConstBuffer.hxx"
#include "StringBuffer.hxx"
#include "Compiler.h"
#include <cstddef>
#include <cstdint>
@@ -53,7 +52,7 @@ HexFormat(char *dest, ConstBuffer<uint8_t> src) noexcept;
* required size.
*/
template<size_t size>
gcc_pure
[[gnu::pure]]
auto
HexFormatBuffer(const uint8_t *src) noexcept
{

View File

@@ -46,7 +46,7 @@ IsValidSchemeChar(char ch)
ch == '+' || ch == '.' || ch == '-';
}
gcc_pure
[[gnu::pure]]
static bool
IsValidScheme(std::string_view p) noexcept
{
@@ -64,7 +64,7 @@ IsValidScheme(std::string_view p) noexcept
* Return the URI part after the scheme specification (and after the
* double slash).
*/
gcc_pure
[[gnu::pure]]
static std::string_view
uri_after_scheme(std::string_view uri) noexcept
{
@@ -120,7 +120,7 @@ uri_get_path(std::string_view uri) noexcept
return uri;
}
gcc_pure
[[gnu::pure]]
static StringView
UriWithoutQueryString(StringView uri) noexcept
{

View File

@@ -30,26 +30,24 @@
#ifndef URI_EXTRACT_HXX
#define URI_EXTRACT_HXX
#include "Compiler.h"
#include <string_view>
/**
* Checks whether the specified URI has a scheme in the form
* "scheme://".
*/
gcc_pure
[[gnu::pure]]
bool
uri_has_scheme(std::string_view uri) noexcept;
/**
* Returns the scheme name of the specified URI, or an empty string.
*/
gcc_pure
[[gnu::pure]]
std::string_view
uri_get_scheme(std::string_view uri) noexcept;
gcc_pure
[[gnu::pure]]
bool
uri_is_relative_path(const char *uri) noexcept;
@@ -57,11 +55,11 @@ uri_is_relative_path(const char *uri) noexcept;
* Returns the URI path (including the query string) or nullptr if the
* given URI has no path.
*/
gcc_pure
[[gnu::pure]]
std::string_view
uri_get_path(std::string_view uri) noexcept;
gcc_pure
[[gnu::pure]]
std::string_view
uri_get_suffix(std::string_view uri) noexcept;
@@ -71,7 +69,7 @@ uri_get_suffix(std::string_view uri) noexcept;
* nullptr; if there is a '#' but no fragment text, it returns an
* empty StringView.
*/
gcc_pure gcc_nonnull_all
[[gnu::pure]] [[gnu::nonnull]]
const char *
uri_get_fragment(const char *uri) noexcept;

View File

@@ -30,8 +30,6 @@
#ifndef URI_UTIL_HXX
#define URI_UTIL_HXX
#include "Compiler.h"
#include <string>
/**
@@ -42,7 +40,7 @@
* - no double slashes
* - no path component begins with a dot
*/
gcc_pure
[[gnu::pure]]
bool
uri_safe_local(const char *uri) noexcept;
@@ -52,7 +50,7 @@ uri_safe_local(const char *uri) noexcept;
* an empty string if nothing needs to be removed, or if the URI is
* not recognized.
*/
gcc_pure
[[gnu::pure]]
std::string
uri_remove_auth(const char *uri) noexcept;
@@ -60,7 +58,7 @@ uri_remove_auth(const char *uri) noexcept;
* Remove dot segments in the URI. For example, uri_squash_dot_segments
* ("foo/bar/.././")=="foo/".
*/
gcc_pure
[[gnu::pure]]
std::string
uri_squash_dot_segments(const char *uri) noexcept;