Restore the warning

This commit is contained in:
Robert Schulze 2024-05-19 12:51:14 +00:00
parent 113bb00005
commit ed28cac4c2
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
11 changed files with 28 additions and 26 deletions

View File

@ -118,6 +118,8 @@ Checks: [
'-readability-magic-numbers',
'-readability-named-parameter',
'-readability-redundant-declaration',
'-readability-redundant-inline-specifier', # generally useful but incompatible with __attribute((always_inline))__ (aka. ALWAYS_INLINE).
# it has an effect only if combined with `inline`: https://godbolt.org/z/Eefd74qdM
'-readability-simplify-boolean-expr',
'-readability-suspicious-call-argument',
'-readability-uppercase-literal-suffix',

View File

@ -62,7 +62,7 @@ public:
static void updatePerformanceCountersIfNeeded();
static ProfileEvents::Counters & getProfileEvents();
static MemoryTracker * getMemoryTracker()
ALWAYS_INLINE inline static MemoryTracker * getMemoryTracker()
{
if (!current_thread) [[unlikely]]
return nullptr;

View File

@ -11,13 +11,13 @@ namespace DB
template <has_find_extreme_implementation T>
struct MinComparator
{
static ALWAYS_INLINE const T & cmp(const T & a, const T & b) { return std::min(a, b); }
static ALWAYS_INLINE inline const T & cmp(const T & a, const T & b) { return std::min(a, b); }
};
template <has_find_extreme_implementation T>
struct MaxComparator
{
static ALWAYS_INLINE const T & cmp(const T & a, const T & b) { return std::max(a, b); }
static ALWAYS_INLINE inline const T & cmp(const T & a, const T & b) { return std::max(a, b); }
};
MULTITARGET_FUNCTION_AVX2_SSE42(

View File

@ -20,7 +20,7 @@ namespace DB
// includes extracting ASCII ngram, UTF8 ngram, ASCII word and UTF8 word
struct ExtractStringImpl
{
static ALWAYS_INLINE const UInt8 * readOneWord(const UInt8 *& pos, const UInt8 * end)
static ALWAYS_INLINE inline const UInt8 * readOneWord(const UInt8 *& pos, const UInt8 * end)
{
// jump separators
while (pos < end && isUTF8Sep(*pos))
@ -35,10 +35,10 @@ struct ExtractStringImpl
}
// we use ASCII non-alphanum character as UTF8 separator
static ALWAYS_INLINE bool isUTF8Sep(const UInt8 c) { return c < 128 && !isAlphaNumericASCII(c); }
static ALWAYS_INLINE inline bool isUTF8Sep(const UInt8 c) { return c < 128 && !isAlphaNumericASCII(c); }
// read one UTF8 character
static ALWAYS_INLINE void readOneUTF8Code(const UInt8 *& pos, const UInt8 * end)
static ALWAYS_INLINE inline void readOneUTF8Code(const UInt8 *& pos, const UInt8 * end)
{
size_t length = UTF8::seqLength(*pos);

View File

@ -31,7 +31,7 @@ extern const int SUPPORT_IS_DISABLED;
struct FunctionDetectLanguageImpl
{
static ALWAYS_INLINE std::string_view codeISO(std::string_view code_string)
static ALWAYS_INLINE inline std::string_view codeISO(std::string_view code_string)
{
if (code_string.ends_with("-Latn"))
code_string.remove_suffix(code_string.size() - 5);

View File

@ -21,7 +21,7 @@ namespace DB
struct FunctionDetectProgrammingLanguageImpl
{
/// Calculate total weight
static ALWAYS_INLINE Float64 stateMachine(
static ALWAYS_INLINE inline Float64 stateMachine(
const FrequencyHolder::Map & standard,
const std::unordered_map<String, Float64> & model)
{

View File

@ -99,7 +99,7 @@ struct Hash
}
template <bool CaseInsensitive>
static ALWAYS_INLINE UInt64 shingleHash(UInt64 crc, const UInt8 * start, size_t size)
static ALWAYS_INLINE inline UInt64 shingleHash(UInt64 crc, const UInt8 * start, size_t size)
{
if (size & 1)
{
@ -153,7 +153,7 @@ struct Hash
}
template <bool CaseInsensitive>
static ALWAYS_INLINE UInt64 shingleHash(const std::vector<BytesRef> & shingle, size_t offset = 0)
static ALWAYS_INLINE inline UInt64 shingleHash(const std::vector<BytesRef> & shingle, size_t offset = 0)
{
UInt64 crc = -1ULL;
@ -177,14 +177,14 @@ struct SimHashImpl
static constexpr size_t min_word_size = 4;
/// Update fingerprint according to hash_value bits.
static ALWAYS_INLINE void updateFingerVector(Int64 * finger_vec, UInt64 hash_value)
static ALWAYS_INLINE inline void updateFingerVector(Int64 * finger_vec, UInt64 hash_value)
{
for (size_t i = 0; i < 64; ++i)
finger_vec[i] += (hash_value & (1ULL << i)) ? 1 : -1;
}
/// Return a 64 bit value according to finger_vec.
static ALWAYS_INLINE UInt64 getSimHash(const Int64 * finger_vec)
static ALWAYS_INLINE inline UInt64 getSimHash(const Int64 * finger_vec)
{
UInt64 res = 0;
@ -200,7 +200,7 @@ struct SimHashImpl
// for each ngram, calculate a 64 bit hash value, and update the vector according the hash value
// finally return a 64 bit value(UInt64), i'th bit is 1 means vector[i] > 0, otherwise, vector[i] < 0
static ALWAYS_INLINE UInt64 ngramHashASCII(const UInt8 * data, size_t size, size_t shingle_size)
static ALWAYS_INLINE inline UInt64 ngramHashASCII(const UInt8 * data, size_t size, size_t shingle_size)
{
if (size < shingle_size)
return Hash::shingleHash<CaseInsensitive>(-1ULL, data, size);
@ -217,7 +217,7 @@ struct SimHashImpl
return getSimHash(finger_vec);
}
static ALWAYS_INLINE UInt64 ngramHashUTF8(const UInt8 * data, size_t size, size_t shingle_size)
static ALWAYS_INLINE inline UInt64 ngramHashUTF8(const UInt8 * data, size_t size, size_t shingle_size)
{
const UInt8 * start = data;
const UInt8 * end = data + size;
@ -259,7 +259,7 @@ struct SimHashImpl
// 2. next, we extract one word each time, and calculate a new hash value of the new word,then use the latest N hash
// values to calculate the next word shingle hash value
static ALWAYS_INLINE UInt64 wordShingleHash(const UInt8 * data, size_t size, size_t shingle_size)
static ALWAYS_INLINE inline UInt64 wordShingleHash(const UInt8 * data, size_t size, size_t shingle_size)
{
const UInt8 * start = data;
const UInt8 * end = data + size;
@ -400,7 +400,7 @@ struct MinHashImpl
using MaxHeap = Heap<std::less<>>;
using MinHeap = Heap<std::greater<>>;
static ALWAYS_INLINE void ngramHashASCII(
static ALWAYS_INLINE inline void ngramHashASCII(
MinHeap & min_heap,
MaxHeap & max_heap,
const UInt8 * data,
@ -429,7 +429,7 @@ struct MinHashImpl
}
}
static ALWAYS_INLINE void ngramHashUTF8(
static ALWAYS_INLINE inline void ngramHashUTF8(
MinHeap & min_heap,
MaxHeap & max_heap,
const UInt8 * data,
@ -472,7 +472,7 @@ struct MinHashImpl
// MinHash word shingle hash value calculate function: String ->Tuple(UInt64, UInt64)
// for each word shingle, we calculate a hash value, but in fact, we just maintain the
// K minimum and K maximum hash value
static ALWAYS_INLINE void wordShingleHash(
static ALWAYS_INLINE inline void wordShingleHash(
MinHeap & min_heap,
MaxHeap & max_heap,
const UInt8 * data,

View File

@ -85,7 +85,7 @@ struct NgramDistanceImpl
}
template <size_t Offset, class Container, size_t... I>
static ALWAYS_INLINE void unrollLowering(Container & cont, const std::index_sequence<I...> &)
static ALWAYS_INLINE inline void unrollLowering(Container & cont, const std::index_sequence<I...> &)
{
((cont[Offset + I] = std::tolower(cont[Offset + I])), ...);
}
@ -195,7 +195,7 @@ struct NgramDistanceImpl
}
template <bool save_ngrams>
static ALWAYS_INLINE size_t calculateNeedleStats(
static ALWAYS_INLINE inline size_t calculateNeedleStats(
const char * data,
const size_t size,
NgramCount * ngram_stats,
@ -228,7 +228,7 @@ struct NgramDistanceImpl
}
template <bool reuse_stats>
static ALWAYS_INLINE UInt64 calculateHaystackStatsAndMetric(
static ALWAYS_INLINE inline UInt64 calculateHaystackStatsAndMetric(
const char * data,
const size_t size,
NgramCount * ngram_stats,

View File

@ -18,7 +18,7 @@ namespace DB
*/
struct FunctionDetectTonalityImpl
{
static ALWAYS_INLINE Float32 detectTonality(
static ALWAYS_INLINE inline Float32 detectTonality(
const UInt8 * str,
const size_t str_len,
const FrequencyHolder::Map & emotional_dict)

View File

@ -124,7 +124,7 @@ public:
bool hasEmptyBound() const { return has_empty_bound; }
bool ALWAYS_INLINE contains(CoordinateType x, CoordinateType y) const
bool ALWAYS_INLINE inline contains(CoordinateType x, CoordinateType y) const
{
Point point(x, y);

View File

@ -38,7 +38,7 @@ public:
UInt64 version = 0;
UInt64 prev_version = 0;
void ALWAYS_INLINE update()
void inline ALWAYS_INLINE update()
{
if (version == prev_version && update_list)
update_list->push_back(id);
@ -46,7 +46,7 @@ public:
++version;
}
void ALWAYS_INLINE trigger() { prev_version = version; }
void inline ALWAYS_INLINE trigger() { prev_version = version; }
};
protected:
@ -249,7 +249,7 @@ public:
}
protected:
void ALWAYS_INLINE updateVersion()
void inline ALWAYS_INLINE updateVersion()
{
if (likely(update_info))
update_info->update();