From ece8aeaaf439ce786be06a084788b2c507ae5bf1 Mon Sep 17 00:00:00 2001 From: Lenny Maiorani Date: Wed, 21 Apr 2021 11:11:38 -0600 Subject: [PATCH] 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. --- AK/EnumBits.h | 116 +++++++++--------- AK/Format.h | 4 +- .../Applications/Spreadsheet/Readers/XSV.h | 2 +- .../Applications/Spreadsheet/Writers/XSV.h | 2 +- Userland/Libraries/LibCrypto/Hash/SHA1.cpp | 2 +- Userland/Libraries/LibGfx/Color.h | 2 +- .../LibGfx/Filters/GenericConvolutionFilter.h | 2 +- 7 files changed, 65 insertions(+), 65 deletions(-) diff --git a/AK/EnumBits.h b/AK/EnumBits.h index 2be7226993..a35b3dbd72 100644 --- a/AK/EnumBits.h +++ b/AK/EnumBits.h @@ -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; \ - return static_cast( \ - static_cast(lhs) | static_cast(rhs)); \ - } \ - \ - [[nodiscard]] Prefix constexpr inline Enum operator&(Enum lhs, Enum rhs) \ - { \ - using Type = UnderlyingType; \ - return static_cast( \ - static_cast(lhs) & static_cast(rhs)); \ - } \ - \ - [[nodiscard]] Prefix constexpr inline Enum operator^(Enum lhs, Enum rhs) \ - { \ - using Type = UnderlyingType; \ - return static_cast( \ - static_cast(lhs) ^ static_cast(rhs)); \ - } \ - \ - [[nodiscard]] Prefix constexpr inline Enum operator~(Enum rhs) \ - { \ - using Type = UnderlyingType; \ - return static_cast( \ - ~static_cast(rhs)); \ - } \ - \ - Prefix constexpr inline Enum& operator|=(Enum& lhs, Enum rhs) \ - { \ - using Type = UnderlyingType; \ - lhs = static_cast( \ - static_cast(lhs) | static_cast(rhs)); \ - return lhs; \ - } \ - \ - Prefix constexpr inline Enum& operator&=(Enum& lhs, Enum rhs) \ - { \ - using Type = UnderlyingType; \ - lhs = static_cast( \ - static_cast(lhs) & static_cast(rhs)); \ - return lhs; \ - } \ - \ - Prefix constexpr inline Enum& operator^=(Enum& lhs, Enum rhs) \ - { \ - using Type = UnderlyingType; \ - lhs = static_cast( \ - static_cast(lhs) ^ static_cast(rhs)); \ - return lhs; \ - } \ - \ - Prefix constexpr inline bool has_flag(Enum value, Enum mask) \ - { \ - using Type = UnderlyingType; \ - return static_cast(value & mask) != 0; \ +#define _AK_ENUM_BITWISE_OPERATORS_INTERNAL(Enum, Prefix) \ + \ + [[nodiscard]] Prefix constexpr Enum operator|(Enum lhs, Enum rhs) \ + { \ + using Type = UnderlyingType; \ + return static_cast( \ + static_cast(lhs) | static_cast(rhs)); \ + } \ + \ + [[nodiscard]] Prefix constexpr Enum operator&(Enum lhs, Enum rhs) \ + { \ + using Type = UnderlyingType; \ + return static_cast( \ + static_cast(lhs) & static_cast(rhs)); \ + } \ + \ + [[nodiscard]] Prefix constexpr Enum operator^(Enum lhs, Enum rhs) \ + { \ + using Type = UnderlyingType; \ + return static_cast( \ + static_cast(lhs) ^ static_cast(rhs)); \ + } \ + \ + [[nodiscard]] Prefix constexpr Enum operator~(Enum rhs) \ + { \ + using Type = UnderlyingType; \ + return static_cast( \ + ~static_cast(rhs)); \ + } \ + \ + Prefix constexpr Enum& operator|=(Enum& lhs, Enum rhs) \ + { \ + using Type = UnderlyingType; \ + lhs = static_cast( \ + static_cast(lhs) | static_cast(rhs)); \ + return lhs; \ + } \ + \ + Prefix constexpr Enum& operator&=(Enum& lhs, Enum rhs) \ + { \ + using Type = UnderlyingType; \ + lhs = static_cast( \ + static_cast(lhs) & static_cast(rhs)); \ + return lhs; \ + } \ + \ + Prefix constexpr Enum& operator^=(Enum& lhs, Enum rhs) \ + { \ + using Type = UnderlyingType; \ + lhs = static_cast( \ + static_cast(lhs) ^ static_cast(rhs)); \ + return lhs; \ + } \ + \ + Prefix constexpr bool has_flag(Enum value, Enum mask) \ + { \ + using Type = UnderlyingType; \ + return static_cast(value & mask) != 0; \ } diff --git a/AK/Format.h b/AK/Format.h index 3193c79220..2054d30768 100644 --- a/AK/Format.h +++ b/AK/Format.h @@ -432,10 +432,10 @@ void dmesgln(CheckedFormatString&& fmt, const Parameters&... para #endif template -inline constexpr bool HasFormatter = true; +constexpr bool HasFormatter = true; template -inline constexpr bool HasFormatter::__no_formatter_defined> = false; +constexpr bool HasFormatter::__no_formatter_defined> = false; template class FormatIfSupported { diff --git a/Userland/Applications/Spreadsheet/Readers/XSV.h b/Userland/Applications/Spreadsheet/Readers/XSV.h index 444c81992d..7bc79ab73c 100644 --- a/Userland/Applications/Spreadsheet/Readers/XSV.h +++ b/Userland/Applications/Spreadsheet/Readers/XSV.h @@ -72,7 +72,7 @@ enum class ReadError { #undef E }; -inline constexpr ParserBehaviour default_behaviours() +constexpr ParserBehaviour default_behaviours() { return ParserBehaviour::QuoteOnlyInFieldStart; } diff --git a/Userland/Applications/Spreadsheet/Writers/XSV.h b/Userland/Applications/Spreadsheet/Writers/XSV.h index a26dc5f08a..b56f659c80 100644 --- a/Userland/Applications/Spreadsheet/Writers/XSV.h +++ b/Userland/Applications/Spreadsheet/Writers/XSV.h @@ -74,7 +74,7 @@ enum class WriteError { #undef E }; -inline constexpr WriterBehaviour default_behaviours() +constexpr WriterBehaviour default_behaviours() { return WriterBehaviour::None; } diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp index 3ff04bffd9..1efe20d8e0 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp @@ -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)); } diff --git a/Userland/Libraries/LibGfx/Color.h b/Userland/Libraries/LibGfx/Color.h index befaa2ed77..a04056730b 100644 --- a/Userland/Libraries/LibGfx/Color.h +++ b/Userland/Libraries/LibGfx/Color.h @@ -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; diff --git a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h index 93f325a28e..4cd034a1b8 100644 --- a/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h +++ b/Userland/Libraries/LibGfx/Filters/GenericConvolutionFilter.h @@ -33,7 +33,7 @@ namespace Gfx { template -inline static constexpr void normalize(Matrix& matrix) +static constexpr void normalize(Matrix& matrix) { auto sum = 0.0f; for (size_t i = 0; i < matrix.Size; ++i) {