Everywhere: Remove redundant inline keyword with constexpr

Problem:
- `constexpr` functions are additionally decorated with `inline`
  keyword. This is redundant since `constexpr` implies `inline`.

Solution:
- Remove redundancies.
This commit is contained in:
Lenny Maiorani 2021-04-21 11:11:38 -06:00 committed by Linus Groh
parent 42bfaef0bb
commit ece8aeaaf4
7 changed files with 65 additions and 65 deletions

View file

@ -40,62 +40,62 @@
#define AK_ENUM_BITWISE_FRIEND_OPERATORS(Enum) \
_AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, friend)
#define _AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, Prefix) \
\
[[nodiscard]] Prefix constexpr inline Enum operator|(Enum lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr inline Enum operator&(Enum lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr inline Enum operator^(Enum lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr inline Enum operator~(Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
~static_cast<Type>(rhs)); \
} \
\
Prefix constexpr inline Enum& operator|=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
return lhs; \
} \
\
Prefix constexpr inline Enum& operator&=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
return lhs; \
} \
\
Prefix constexpr inline Enum& operator^=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
return lhs; \
} \
\
Prefix constexpr inline bool has_flag(Enum value, Enum mask) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Type>(value & mask) != 0; \
#define _AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, Prefix) \
\
[[nodiscard]] Prefix constexpr Enum operator|(Enum lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr Enum operator&(Enum lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr Enum operator^(Enum lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
} \
\
[[nodiscard]] Prefix constexpr Enum operator~(Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Enum>( \
~static_cast<Type>(rhs)); \
} \
\
Prefix constexpr Enum& operator|=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) | static_cast<Type>(rhs)); \
return lhs; \
} \
\
Prefix constexpr Enum& operator&=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) & static_cast<Type>(rhs)); \
return lhs; \
} \
\
Prefix constexpr Enum& operator^=(Enum& lhs, Enum rhs) \
{ \
using Type = UnderlyingType<Enum>; \
lhs = static_cast<Enum>( \
static_cast<Type>(lhs) ^ static_cast<Type>(rhs)); \
return lhs; \
} \
\
Prefix constexpr bool has_flag(Enum value, Enum mask) \
{ \
using Type = UnderlyingType<Enum>; \
return static_cast<Type>(value & mask) != 0; \
}

View file

@ -432,10 +432,10 @@ void dmesgln(CheckedFormatString<Parameters...>&& fmt, const Parameters&... para
#endif
template<typename T, typename = void>
inline constexpr bool HasFormatter = true;
constexpr bool HasFormatter = true;
template<typename T>
inline constexpr bool HasFormatter<T, typename Formatter<T>::__no_formatter_defined> = false;
constexpr bool HasFormatter<T, typename Formatter<T>::__no_formatter_defined> = false;
template<typename T>
class FormatIfSupported {

View file

@ -72,7 +72,7 @@ enum class ReadError {
#undef E
};
inline constexpr ParserBehaviour default_behaviours()
constexpr ParserBehaviour default_behaviours()
{
return ParserBehaviour::QuoteOnlyInFieldStart;
}

View file

@ -74,7 +74,7 @@ enum class WriteError {
#undef E
};
inline constexpr WriterBehaviour default_behaviours()
constexpr WriterBehaviour default_behaviours()
{
return WriterBehaviour::None;
}

View file

@ -31,7 +31,7 @@
namespace Crypto {
namespace Hash {
inline static constexpr auto ROTATE_LEFT(u32 value, size_t bits)
static constexpr auto ROTATE_LEFT(u32 value, size_t bits)
{
return (value << bits) | (value >> (32 - bits));
}

View file

@ -319,7 +319,7 @@ private:
RGBA32 m_value { 0 };
};
inline constexpr Color::Color(NamedColor named)
constexpr Color::Color(NamedColor named)
{
if (named == Transparent) {
m_value = 0;

View file

@ -33,7 +33,7 @@
namespace Gfx {
template<size_t N, typename T>
inline static constexpr void normalize(Matrix<N, T>& matrix)
static constexpr void normalize(Matrix<N, T>& matrix)
{
auto sum = 0.0f;
for (size_t i = 0; i < matrix.Size; ++i) {