1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:37:34 +00:00

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

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

View file

@ -432,10 +432,10 @@ void dmesgln(CheckedFormatString<Parameters...>&& fmt, const Parameters&... para
#endif #endif
template<typename T, typename = void> template<typename T, typename = void>
inline constexpr bool HasFormatter = true; constexpr bool HasFormatter = true;
template<typename T> 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> template<typename T>
class FormatIfSupported { class FormatIfSupported {

View file

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

View file

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

View file

@ -31,7 +31,7 @@
namespace Crypto { namespace Crypto {
namespace Hash { 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)); return (value << bits) | (value >> (32 - bits));
} }

View file

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

View file

@ -33,7 +33,7 @@
namespace Gfx { namespace Gfx {
template<size_t N, typename T> 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; auto sum = 0.0f;
for (size_t i = 0; i < matrix.Size; ++i) { for (size_t i = 0; i < matrix.Size; ++i) {