diff --git a/be/src/common/signal_handler.h b/be/src/common/signal_handler.h index c7b655cbea..85da4e7096 100644 --- a/be/src/common/signal_handler.h +++ b/be/src/common/signal_handler.h @@ -235,7 +235,7 @@ void (*g_failure_writer)(const char* data, size_t size) = WriteToStderr; // Dumps time information. We don't dump human-readable time information // as localtime() is not guaranteed to be async signal safe. void DumpTimeInfo() { - time_t time_in_sec = time(NULL); + time_t time_in_sec = time(nullptr); char buf[256]; // Big enough for time info. MinimalFormatter formatter(buf, sizeof(buf)); formatter.AppendString("*** Query id: "); @@ -258,7 +258,7 @@ void DumpTimeInfo() { // Dumps information about the signal to STDERR. void DumpSignalInfo(int signal_number, siginfo_t* siginfo) { // Get the signal name. - const char* signal_name = NULL; + const char* signal_name = nullptr; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kFailureSignals); ++i) { if (signal_number == kFailureSignals[i].number) { signal_name = kFailureSignals[i].name; @@ -322,7 +322,7 @@ void InvokeDefaultSignalHandler(int signal_number) { memset(&sig_action, 0, sizeof(sig_action)); sigemptyset(&sig_action.sa_mask); sig_action.sa_handler = SIG_DFL; - sigaction(signal_number, &sig_action, NULL); + sigaction(signal_number, &sig_action, nullptr); kill(getpid(), signal_number); } @@ -330,14 +330,14 @@ void InvokeDefaultSignalHandler(int signal_number) { // dumping stuff while another thread is doing it. Our policy is to let // the first thread dump stuff and let other threads wait. // See also comments in FailureSignalHandler(). -static pthread_t* g_entered_thread_id_pointer = NULL; +static pthread_t* g_entered_thread_id_pointer = nullptr; // Wrapper of __sync_val_compare_and_swap. If the GCC extension isn't // defined, we try the CPU specific logics (we only support x86 and // x86_64 for now) first, then use a naive implementation, which has a // race condition. template -inline T sync_val_compare_and_swap(T* ptr, T oldval, T newval) { +T sync_val_compare_and_swap(T* ptr, T oldval, T newval) { #if defined(HAVE___SYNC_VAL_COMPARE_AND_SWAP) return __sync_val_compare_and_swap(ptr, oldval, newval); #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) @@ -376,8 +376,8 @@ void FailureSignalHandler(int signal_number, siginfo_t* signal_info, void* ucont // old value (value returned from __sync_val_compare_and_swap) is // different from the original value (in this case NULL). pthread_t* old_thread_id_pointer = sync_val_compare_and_swap( - &g_entered_thread_id_pointer, static_cast(NULL), &my_thread_id); - if (old_thread_id_pointer != NULL) { + &g_entered_thread_id_pointer, static_cast(nullptr), &my_thread_id); + if (old_thread_id_pointer != nullptr) { // We've already entered the signal handler. What should we do? if (pthread_equal(my_thread_id, *g_entered_thread_id_pointer)) { // It looks the current thread is reentering the signal handler. @@ -431,7 +431,7 @@ inline void InstallFailureSignalHandler() { sig_action.sa_sigaction = &FailureSignalHandler; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kFailureSignals); ++i) { - CHECK_ERR(sigaction(kFailureSignals[i].number, &sig_action, NULL)); + CHECK_ERR(sigaction(kFailureSignals[i].number, &sig_action, nullptr)); } kFailureSignalHandlerInstalled = true; } diff --git a/be/src/common/status.h b/be/src/common/status.h index 2c0da39b8e..254c25e528 100644 --- a/be/src/common/status.h +++ b/be/src/common/status.h @@ -259,7 +259,7 @@ E(INVERTED_INDEX_NO_TERMS, -6005); // clang-format off // whether to capture stacktrace template -static constexpr bool capture_stacktrace() { +constexpr bool capture_stacktrace() { return code != ErrorCode::OK && code != ErrorCode::END_OF_FILE && code != ErrorCode::MEM_LIMIT_EXCEEDED diff --git a/be/src/common/utils.h b/be/src/common/utils.h index 499b727f5b..b03e41260e 100644 --- a/be/src/common/utils.h +++ b/be/src/common/utils.h @@ -66,7 +66,7 @@ static_assert((RELEASE_CONTEXT_COUNTER & (RELEASE_CONTEXT_COUNTER - 1)) == 0, "should be power of 2"); template -static inline To convert_to(From from) { +To convert_to(From from) { union { From _from; To _to; diff --git a/be/src/exec/es/es_scroll_parser.cpp b/be/src/exec/es/es_scroll_parser.cpp index 06d0884db5..5c50aecede 100644 --- a/be/src/exec/es/es_scroll_parser.cpp +++ b/be/src/exec/es/es_scroll_parser.cpp @@ -140,8 +140,8 @@ static const std::string INVALID_NULL_VALUE = } while (false) template -static Status get_int_value(const rapidjson::Value& col, PrimitiveType type, void* slot, - bool pure_doc_value) { +Status get_int_value(const rapidjson::Value& col, PrimitiveType type, void* slot, + bool pure_doc_value) { if (col.IsNumber()) { *reinterpret_cast(slot) = (T)(sizeof(T) < 8 ? col.GetInt() : col.GetInt64()); return Status::OK(); @@ -173,8 +173,8 @@ static Status get_int_value(const rapidjson::Value& col, PrimitiveType type, voi } template -static Status get_date_value_int(const rapidjson::Value& col, PrimitiveType type, bool is_date_str, - RT* slot) { +Status get_date_value_int(const rapidjson::Value& col, PrimitiveType type, bool is_date_str, + RT* slot) { constexpr bool is_datetime_v1 = std::is_same_v; T dt_val; if (is_date_str) { @@ -238,8 +238,8 @@ static Status get_date_value_int(const rapidjson::Value& col, PrimitiveType type } template -static Status get_date_int(const rapidjson::Value& col, PrimitiveType type, bool pure_doc_value, - RT* slot) { +Status get_date_int(const rapidjson::Value& col, PrimitiveType type, bool pure_doc_value, + RT* slot) { // this would happend just only when `enable_docvalue_scan = false`, and field has timestamp format date from _source if (col.IsNumber()) { // ES process date/datetime field would use millisecond timestamp for index or docvalue @@ -265,8 +265,8 @@ static Status get_date_int(const rapidjson::Value& col, PrimitiveType type, bool } } template -static Status fill_date_int(const rapidjson::Value& col, PrimitiveType type, bool pure_doc_value, - vectorized::IColumn* col_ptr) { +Status fill_date_int(const rapidjson::Value& col, PrimitiveType type, bool pure_doc_value, + vectorized::IColumn* col_ptr) { RT data; RETURN_IF_ERROR((get_date_int(col, type, pure_doc_value, &data))); col_ptr->insert_data(const_cast(reinterpret_cast(&data)), 0); @@ -274,8 +274,8 @@ static Status fill_date_int(const rapidjson::Value& col, PrimitiveType type, boo } template -static Status get_float_value(const rapidjson::Value& col, PrimitiveType type, void* slot, - bool pure_doc_value) { +Status get_float_value(const rapidjson::Value& col, PrimitiveType type, void* slot, + bool pure_doc_value) { static_assert(sizeof(T) == 4 || sizeof(T) == 8); if (col.IsNumber()) { *reinterpret_cast(slot) = (T)(sizeof(T) == 4 ? col.GetFloat() : col.GetDouble()); @@ -301,8 +301,8 @@ static Status get_float_value(const rapidjson::Value& col, PrimitiveType type, v } template -static Status insert_float_value(const rapidjson::Value& col, PrimitiveType type, - vectorized::IColumn* col_ptr, bool pure_doc_value, bool nullable) { +Status insert_float_value(const rapidjson::Value& col, PrimitiveType type, + vectorized::IColumn* col_ptr, bool pure_doc_value, bool nullable) { static_assert(sizeof(T) == 4 || sizeof(T) == 8); if (col.IsNumber() && nullable) { T value = (T)(sizeof(T) == 4 ? col.GetFloat() : col.GetDouble()); @@ -331,8 +331,8 @@ static Status insert_float_value(const rapidjson::Value& col, PrimitiveType type } template -static Status insert_int_value(const rapidjson::Value& col, PrimitiveType type, - vectorized::IColumn* col_ptr, bool pure_doc_value, bool nullable) { +Status insert_int_value(const rapidjson::Value& col, PrimitiveType type, + vectorized::IColumn* col_ptr, bool pure_doc_value, bool nullable) { if (col.IsNumber()) { T value = (T)(sizeof(T) < 8 ? col.GetInt() : col.GetInt64()); col_ptr->insert_data(const_cast(reinterpret_cast(&value)), 0); diff --git a/be/src/exec/olap_utils.h b/be/src/exec/olap_utils.h index e1af76f01d..610299cc0f 100644 --- a/be/src/exec/olap_utils.h +++ b/be/src/exec/olap_utils.h @@ -27,12 +27,12 @@ namespace doris { -typedef bool (*CompareLargeFunc)(const void*, const void*); +using CompareLargeFunc = bool (*)(const void*, const void*); static const char* NEGATIVE_INFINITY = "-oo"; static const char* POSITIVE_INFINITY = "+oo"; -typedef struct OlapScanRange { +struct OlapScanRange { public: OlapScanRange() : begin_include(true), end_include(true) { begin_scan_range.add_value(NEGATIVE_INFINITY); @@ -49,7 +49,7 @@ public: bool end_include; OlapTuple begin_scan_range; OlapTuple end_scan_range; -} OlapScanRange; +}; static char encoding_table[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', @@ -97,7 +97,7 @@ enum SQLFilterOp { }; template -static constexpr bool always_false_v = false; +constexpr bool always_false_v = false; inline SQLFilterOp to_olap_filter_type(TExprOpcode::type type, bool opposite) { switch (type) { diff --git a/be/src/exprs/create_predicate_function.h b/be/src/exprs/create_predicate_function.h index 33efebb325..cbb8a45a3b 100644 --- a/be/src/exprs/create_predicate_function.h +++ b/be/src/exprs/create_predicate_function.h @@ -155,9 +155,9 @@ inline auto create_bitmap_filter(PrimitiveType type) { } template -inline ColumnPredicate* create_olap_column_predicate( - uint32_t column_id, const std::shared_ptr& filter, int be_exec_version, - const TabletColumn*) { +ColumnPredicate* create_olap_column_predicate(uint32_t column_id, + const std::shared_ptr& filter, + int be_exec_version, const TabletColumn*) { std::shared_ptr filter_olap; filter_olap.reset(create_bloom_filter(PT)); filter_olap->light_copy(filter.get()); @@ -165,9 +165,9 @@ inline ColumnPredicate* create_olap_column_predicate( } template -inline ColumnPredicate* create_olap_column_predicate( - uint32_t column_id, const std::shared_ptr& filter, - int be_exec_version, const TabletColumn*) { +ColumnPredicate* create_olap_column_predicate(uint32_t column_id, + const std::shared_ptr& filter, + int be_exec_version, const TabletColumn*) { if constexpr (PT == TYPE_TINYINT || PT == TYPE_SMALLINT || PT == TYPE_INT || PT == TYPE_BIGINT) { std::shared_ptr filter_olap; @@ -180,17 +180,16 @@ inline ColumnPredicate* create_olap_column_predicate( } template -inline ColumnPredicate* create_olap_column_predicate(uint32_t column_id, - const std::shared_ptr& filter, - int, const TabletColumn* column = nullptr) { +ColumnPredicate* create_olap_column_predicate(uint32_t column_id, + const std::shared_ptr& filter, int, + const TabletColumn* column = nullptr) { return new InListPredicateBase(column_id, filter, column->length()); } template -inline ColumnPredicate* create_column_predicate(uint32_t column_id, - const std::shared_ptr& filter, FieldType type, - int be_exec_version, - const TabletColumn* column = nullptr) { +ColumnPredicate* create_column_predicate(uint32_t column_id, const std::shared_ptr& filter, + FieldType type, int be_exec_version, + const TabletColumn* column = nullptr) { switch (type) { #define M(NAME) \ case OLAP_FIELD_##NAME: { \ diff --git a/be/src/gutil/atomicops-internals-x86.h b/be/src/gutil/atomicops-internals-x86.h index 92762f9be6..7d57b71a13 100644 --- a/be/src/gutil/atomicops-internals-x86.h +++ b/be/src/gutil/atomicops-internals-x86.h @@ -63,7 +63,7 @@ typedef int64_t Atomic64; // hard-to-track-down bugs, if the pointer isn't naturally aligned. Check alignment // in debug mode. template -inline void CheckNaturalAlignment(const T* ptr) { +void CheckNaturalAlignment(const T* ptr) { DCHECK_EQ(0, reinterpret_cast(ptr) & (sizeof(T) - 1)) << "unaligned pointer not allowed for atomics"; } diff --git a/be/src/gutil/basictypes.h b/be/src/gutil/basictypes.h index f0cebc589d..ad191b5f3c 100644 --- a/be/src/gutil/basictypes.h +++ b/be/src/gutil/basictypes.h @@ -21,4 +21,4 @@ enum Ownership { DO_NOT_TAKE_OWNERSHIP, TAKE_OWNERSHIP }; // ignore_result(my_var.release()); // template -inline void ignore_result(const T&) {} +void ignore_result(const T&) {} diff --git a/be/src/gutil/bits.h b/be/src/gutil/bits.h index 4ffc7614bc..9db9ee867c 100644 --- a/be/src/gutil/bits.h +++ b/be/src/gutil/bits.h @@ -229,7 +229,7 @@ inline int Bits::FindLSBSetNonZero64_Portable(uint64 n) { } template -inline bool Bits::BytesContainByteLessThan(T bytes, uint8 c) { + bool Bits::BytesContainByteLessThan(T bytes, uint8 c) { T l = BitPattern::l; T h = BitPattern::h; // The c <= 0x80 code is straight out of Knuth Volume 4. @@ -239,13 +239,13 @@ inline bool Bits::BytesContainByteLessThan(T bytes, uint8 c) { } template -inline bool Bits::BytesContainByte(T bytes, uint8 c) { + bool Bits::BytesContainByte(T bytes, uint8 c) { // Usually c will be manifestly constant. return Bits::BytesContainByteLessThan(bytes ^ (c * BitPattern::l), 1); } template -inline bool Bits::BytesAllInRange(T bytes, uint8 lo, uint8 hi) { + bool Bits::BytesAllInRange(T bytes, uint8 lo, uint8 hi) { T l = BitPattern::l; T h = BitPattern::h; // In the common case, lo and hi are manifest constants. diff --git a/be/src/gutil/casts.h b/be/src/gutil/casts.h index 8e2a1a5cad..6decf8c0a5 100644 --- a/be/src/gutil/casts.h +++ b/be/src/gutil/casts.h @@ -34,14 +34,14 @@ // base::identity_ is used to make a non-deduced context, which // forces all callers to explicitly specify the template argument. template -inline To implicit_cast(typename base::identity_::type to) { + To implicit_cast(typename base::identity_::type to) { return to; } // This version of implicit_cast is used when two template arguments // are specified. It's obsolete and should not be used. template -inline To implicit_cast(typename base::identity_::type const& f) { + To implicit_cast(typename base::identity_::type const& f) { return f; } @@ -89,7 +89,7 @@ inline To down_cast(From* f) { // so we only accept pointers // or the reference form. If you call down_cast with a const T&, the // compiler will just bind From to const T. template -inline To down_cast(From& f) { + To down_cast(From& f) { COMPILE_ASSERT(std::is_reference::value, target_type_not_a_reference); using ToAsPointer = typename std::remove_reference::type*; if (false) { @@ -161,7 +161,7 @@ inline To down_cast(From& f) { // -- mec 2005-10-17 template -inline Dest bit_cast(const Source& source) { + Dest bit_cast(const Source& source) { // Compile time assertion: sizeof(Dest) == sizeof(Source) // A compile error here means your Dest and Source have different sizes. COMPILE_ASSERT(sizeof(Dest) == sizeof(Source), VerifySizesAreEqual); @@ -279,7 +279,7 @@ public: // because of value propagation on the constant enumerator bounds. template -inline bool loose_enum_test(int e_val) { + bool loose_enum_test(int e_val) { COMPILE_ASSERT(enum_limits::is_specialized, missing_MAKE_ENUM_LIMITS); const Enum e_min = enum_limits::min_enumerator; const Enum e_max = enum_limits::max_enumerator; @@ -333,7 +333,7 @@ inline bool loose_enum_test(int e_val) { } template -inline bool tight_enum_test(int e_val) { + bool tight_enum_test(int e_val) { COMPILE_ASSERT(enum_limits::is_specialized, missing_MAKE_ENUM_LIMITS); const Enum e_min = enum_limits::min_enumerator; const Enum e_max = enum_limits::max_enumerator; @@ -341,7 +341,7 @@ inline bool tight_enum_test(int e_val) { } template -inline bool loose_enum_test_cast(int e_val, Enum* e_var) { + bool loose_enum_test_cast(int e_val, Enum* e_var) { if (loose_enum_test(e_val)) { *e_var = static_cast(e_val); return true; @@ -351,7 +351,7 @@ inline bool loose_enum_test_cast(int e_val, Enum* e_var) { } template -inline bool tight_enum_test_cast(int e_val, Enum* e_var) { + bool tight_enum_test_cast(int e_val, Enum* e_var) { if (tight_enum_test(e_val)) { *e_var = static_cast(e_val); return true; @@ -371,7 +371,7 @@ inline void WarnEnumCastError(int value_of_int) { } // namespace base template -inline Enum loose_enum_cast(int e_val) { + Enum loose_enum_cast(int e_val) { if (!loose_enum_test(e_val)) { base::internal::WarnEnumCastError(e_val); } @@ -379,7 +379,7 @@ inline Enum loose_enum_cast(int e_val) { } template -inline Enum tight_enum_cast(int e_val) { + Enum tight_enum_cast(int e_val) { if (!tight_enum_test(e_val)) { base::internal::WarnEnumCastError(e_val); } diff --git a/be/src/gutil/dynamic_annotations.h b/be/src/gutil/dynamic_annotations.h index f0016d20ae..0001eef160 100644 --- a/be/src/gutil/dynamic_annotations.h +++ b/be/src/gutil/dynamic_annotations.h @@ -566,7 +566,7 @@ void __asan_set_death_callback(void (*callback)(void)); one can use ... = ANNOTATE_UNPROTECTED_READ(x); */ template -inline T ANNOTATE_UNPROTECTED_READ(const volatile T& x) ANNOTALYSIS_UNPROTECTED_READ { + T ANNOTATE_UNPROTECTED_READ(const volatile T& x) ANNOTALYSIS_UNPROTECTED_READ { ANNOTATE_IGNORE_READS_BEGIN(); T res = x; ANNOTATE_IGNORE_READS_END(); @@ -635,7 +635,7 @@ inline T ANNOTATE_UNPROTECTED_READ(const volatile T& x) ANNOTALYSIS_UNPROTECTED_ #if defined(__cplusplus) #undef ANNOTATE_UNPROTECTED_READ template -inline T ANNOTATE_UNPROTECTED_READ(const volatile T& x) ANNOTALYSIS_UNPROTECTED_READ { + T ANNOTATE_UNPROTECTED_READ(const volatile T& x) ANNOTALYSIS_UNPROTECTED_READ { ANNOTATE_IGNORE_READS_BEGIN(); T res = x; ANNOTATE_IGNORE_READS_END(); @@ -675,7 +675,7 @@ inline T ANNOTATE_UNPROTECTED_READ(const volatile T& x) ANNOTALYSIS_UNPROTECTED_ #if defined(__cplusplus) #undef ANNOTATE_UNPROTECTED_READ template -inline T ANNOTATE_UNPROTECTED_READ(const volatile T& x) { + T ANNOTATE_UNPROTECTED_READ(const volatile T& x) { ANNOTATE_IGNORE_READS_BEGIN(); T res = x; ANNOTATE_IGNORE_READS_END(); diff --git a/be/src/gutil/gscoped_ptr.h b/be/src/gutil/gscoped_ptr.h index 01305b9294..c578501d56 100644 --- a/be/src/gutil/gscoped_ptr.h +++ b/be/src/gutil/gscoped_ptr.h @@ -786,17 +786,17 @@ private: }; template -inline void swap(gscoped_ptr_malloc& a, gscoped_ptr_malloc& b) { +void swap(gscoped_ptr_malloc& a, gscoped_ptr_malloc& b) { a.swap(b); } template -inline bool operator==(C* p, const gscoped_ptr_malloc& b) { +bool operator==(C* p, const gscoped_ptr_malloc& b) { return p == b.get(); } template -inline bool operator!=(C* p, const gscoped_ptr_malloc& b) { +bool operator!=(C* p, const gscoped_ptr_malloc& b) { return p != b.get(); } diff --git a/be/src/gutil/port.h b/be/src/gutil/port.h index aadccba222..3f8a431d65 100644 --- a/be/src/gutil/port.h +++ b/be/src/gutil/port.h @@ -197,7 +197,7 @@ const char PATH_SEPARATOR = '/'; // a compiler error here. // #include -inline void va_copy(va_list& a, va_list& b) { +void va_copy(va_list& a, va_list& b) { a = b; } diff --git a/be/src/gutil/stl_util.h b/be/src/gutil/stl_util.h index c528465ada..e3aa6dc57a 100644 --- a/be/src/gutil/stl_util.h +++ b/be/src/gutil/stl_util.h @@ -85,7 +85,7 @@ void STLClearObject(deque* obj) { // Reduce memory usage on behalf of object if its capacity is greater // than or equal to "limit", which defaults to 2^20. template -inline void STLClearIfBig(T* obj, size_t limit = 1 << 20) { + void STLClearIfBig(T* obj, size_t limit = 1 << 20) { if (obj->capacity() >= limit) { STLClearObject(obj); } else { @@ -95,7 +95,7 @@ inline void STLClearIfBig(T* obj, size_t limit = 1 << 20) { // Specialization for deque, which doesn't implement capacity(). template -inline void STLClearIfBig(deque* obj, size_t limit = 1 << 20) { + void STLClearIfBig(deque* obj, size_t limit = 1 << 20) { if (obj->size() >= limit) { STLClearObject(obj); } else { @@ -123,7 +123,7 @@ inline void STLClearIfBig(deque* obj, size_t limit = 1 << 20) { // operations cheap. Note that the default number of buckets is 193 // in the Gnu library implementation as of Jan '08. template -inline void STLClearHashIfBig(T* obj, size_t limit) { + void STLClearHashIfBig(T* obj, size_t limit) { if (obj->bucket_count() >= limit) { T tmp; tmp.swap(*obj); @@ -311,7 +311,7 @@ inline void STLAppendToString(string* str, const char* ptr, size_t n) { // change this as well. template -inline T* vector_as_array(vector* v) { + T* vector_as_array(vector* v) { #ifdef NDEBUG return &*v->begin(); #else @@ -320,7 +320,7 @@ inline T* vector_as_array(vector* v) { } template -inline const T* vector_as_array(const vector* v) { + const T* vector_as_array(const vector* v) { #ifdef NDEBUG return &*v->begin(); #else @@ -352,7 +352,7 @@ inline char* string_as_array(string* str) { // differed. template -inline bool HashSetEquality(const HashSet& set_a, const HashSet& set_b) { + bool HashSetEquality(const HashSet& set_a, const HashSet& set_b) { if (set_a.size() != set_b.size()) return false; for (typename HashSet::const_iterator i = set_a.begin(); i != set_a.end(); ++i) if (set_b.find(*i) == set_b.end()) return false; @@ -360,7 +360,7 @@ inline bool HashSetEquality(const HashSet& set_a, const HashSet& set_b) { } template -inline bool HashMapEquality(const HashMap& map_a, const HashMap& map_b) { + bool HashMapEquality(const HashMap& map_a, const HashMap& map_b) { if (map_a.size() != map_b.size()) return false; for (typename HashMap::const_iterator i = map_a.begin(); i != map_a.end(); ++i) { typename HashMap::const_iterator j = map_b.find(i->first); diff --git a/be/src/gutil/strings/escaping.cc b/be/src/gutil/strings/escaping.cc index 68996f5a40..bf7fd212f6 100644 --- a/be/src/gutil/strings/escaping.cc +++ b/be/src/gutil/strings/escaping.cc @@ -1697,7 +1697,7 @@ static char hex_char[] = "0123456789abcdef"; // or a string. This works because we use the [] operator to access // individual characters at a time. template -static void a2b_hex_t(const char* a, T b, int num) { +void a2b_hex_t(const char* a, T b, int num) { for (int i = 0; i < num; i++) { b[i] = (hex_value[a[i * 2] & 0xFF] << 4) + (hex_value[a[i * 2 + 1] & 0xFF]); } @@ -1725,7 +1725,7 @@ string a2b_bin(const string& a, bool byte_order_msb) { // or a string. This works because we use the [] operator to access // individual characters at a time. template -static void b2a_hex_t(const unsigned char* b, T a, int num) { +void b2a_hex_t(const unsigned char* b, T a, int num) { for (int i = 0; i < num; i++) { a[i * 2 + 0] = hex_char[b[i] >> 4]; a[i * 2 + 1] = hex_char[b[i] & 0xf]; diff --git a/be/src/gutil/strings/join.h b/be/src/gutil/strings/join.h index 2a42104303..d2c1bbf408 100644 --- a/be/src/gutil/strings/join.h +++ b/be/src/gutil/strings/join.h @@ -152,12 +152,12 @@ string JoinStringsInArray(string const* components, int num_components, const ch // Definitions of above JoinStrings* methods // ---------------------------------------------------------------------- template -inline void JoinStrings(const CONTAINER& components, const StringPiece& delim, string* result) { +void JoinStrings(const CONTAINER& components, const StringPiece& delim, string* result) { JoinStringsIterator(components.begin(), components.end(), delim, result); } template -inline string JoinStrings(const CONTAINER& components, const StringPiece& delim) { +string JoinStrings(const CONTAINER& components, const StringPiece& delim) { string result; JoinStrings(components, delim, &result); return result; @@ -202,8 +202,7 @@ void JoinStringsIterator(const ITERATOR& start, const ITERATOR& end, const Strin } template -inline string JoinStringsIterator(const ITERATOR& start, const ITERATOR& end, - const StringPiece& delim) { +string JoinStringsIterator(const ITERATOR& start, const ITERATOR& end, const StringPiece& delim) { string result; JoinStringsIterator(start, end, delim, &result); return result; @@ -300,12 +299,12 @@ string JoinElementsIterator(ITERATOR first, ITERATOR last, StringPiece delim) { } template -inline void JoinElements(const CONTAINER& components, StringPiece delim, string* result) { +void JoinElements(const CONTAINER& components, StringPiece delim, string* result) { JoinElementsIterator(components.begin(), components.end(), delim, result); } template -inline string JoinElements(const CONTAINER& components, StringPiece delim) { +string JoinElements(const CONTAINER& components, StringPiece delim) { string result; JoinElements(components, delim, &result); return result; @@ -317,6 +316,6 @@ void JoinInts(const CONTAINER& components, const char* delim, string* result) { } template -inline string JoinInts(const CONTAINER& components, const char* delim) { +string JoinInts(const CONTAINER& components, const char* delim) { return JoinElements(components, delim); } diff --git a/be/src/gutil/strings/split.cc b/be/src/gutil/strings/split.cc index 610b1ee7ea..60939e7418 100644 --- a/be/src/gutil/strings/split.cc +++ b/be/src/gutil/strings/split.cc @@ -327,8 +327,7 @@ static int CalculateReserveForVector(const string& full, const char* delim) { // the characters in the string, not the entire string as a single delimiter. // ---------------------------------------------------------------------- template -static inline void SplitStringToIteratorUsing(const StringType& full, const char* delim, - ITR& result) { +void SplitStringToIteratorUsing(const StringType& full, const char* delim, ITR& result) { // Optimize the common case where delim is a single character. if (delim[0] != '\0' && delim[1] == '\0') { char c = delim[0]; @@ -471,9 +470,8 @@ string SplitOneStringToken(const char** source, const char* delim) { // account. '\' is not allowed as a delimiter. // ---------------------------------------------------------------------- template -static inline void SplitStringWithEscapingToIterator(const string& src, - const strings::CharSet& delimiters, - const bool allow_empty, ITR* result) { +void SplitStringWithEscapingToIterator(const string& src, const strings::CharSet& delimiters, + const bool allow_empty, ITR* result) { CHECK(!delimiters.Test('\\')) << "\\ is not allowed as a delimiter."; CHECK(result); string part; diff --git a/be/src/gutil/strings/split.h b/be/src/gutil/strings/split.h index 7889a5a8a6..1ea3e71e73 100644 --- a/be/src/gutil/strings/split.h +++ b/be/src/gutil/strings/split.h @@ -292,12 +292,12 @@ namespace strings { // Definitions of the main Split() function. template -inline internal::Splitter Split(StringPiece text, Delimiter d) { +internal::Splitter Split(StringPiece text, Delimiter d) { return internal::Splitter(text, d); } template -inline internal::Splitter Split(StringPiece text, Delimiter d, Predicate p) { +internal::Splitter Split(StringPiece text, Delimiter d, Predicate p) { return internal::Splitter(text, d, p); } @@ -415,7 +415,7 @@ private: // Literal as the default if string-like objects are passed as the delimiter // parameter. This is similar to the overloads for Split() below. template -inline LimitImpl Limit(Delimiter delim, int limit) { +LimitImpl Limit(Delimiter delim, int limit) { return LimitImpl(delim, limit); } @@ -499,23 +499,22 @@ inline internal::Splitter Split(StringPiece text, StringPiec // Same overloads as above, but also including a Predicate argument. template -inline internal::Splitter Split(StringPiece text, - const char* delimiter, Predicate p) { +internal::Splitter Split(StringPiece text, const char* delimiter, + Predicate p) { return internal::Splitter(text, delimiter::Literal(delimiter), p); } template -inline internal::Splitter Split(StringPiece text, - const string& delimiter, - Predicate p) { +internal::Splitter Split(StringPiece text, const string& delimiter, + Predicate p) { return internal::Splitter(text, delimiter::Literal(delimiter), p); } template -inline internal::Splitter Split(StringPiece text, - StringPiece delimiter, Predicate p) { +internal::Splitter Split(StringPiece text, StringPiece delimiter, + Predicate p) { return internal::Splitter(text, delimiter::Literal(delimiter), p); } diff --git a/be/src/gutil/strings/strip.h b/be/src/gutil/strings/strip.h index b9c8d59c42..b4221d7d45 100644 --- a/be/src/gutil/strings/strip.h +++ b/be/src/gutil/strings/strip.h @@ -115,7 +115,7 @@ void StripWhiteSpace(string* str); namespace strings { template -inline void StripWhiteSpaceInCollection(Collection* collection) { +void StripWhiteSpaceInCollection(Collection* collection) { for (typename Collection::iterator it = collection->begin(); it != collection->end(); ++it) StripWhiteSpace(&(*it)); } diff --git a/be/src/gutil/strings/util.cc b/be/src/gutil/strings/util.cc index 57751ce398..3225fe992b 100644 --- a/be/src/gutil/strings/util.cc +++ b/be/src/gutil/strings/util.cc @@ -776,8 +776,8 @@ static bool IsWildcard(Rune character) { // Move the strings pointers to the point where they start to differ. template -static void EatSameChars(const CHAR** pattern, const CHAR* pattern_end, const CHAR** string, - const CHAR* string_end, NEXT next) { +void EatSameChars(const CHAR** pattern, const CHAR* pattern_end, const CHAR** string, + const CHAR* string_end, NEXT next) { const CHAR* escape = nullptr; while (*pattern != pattern_end && *string != string_end) { if (!escape && IsWildcard(**pattern)) { @@ -818,7 +818,7 @@ static void EatSameChars(const CHAR** pattern, const CHAR* pattern_end, const CH } template -static void EatWildcard(const CHAR** pattern, const CHAR* end, NEXT next) { +void EatWildcard(const CHAR** pattern, const CHAR* end, NEXT next) { while (*pattern != end) { if (!IsWildcard(**pattern)) return; next(pattern, end); @@ -826,8 +826,8 @@ static void EatWildcard(const CHAR** pattern, const CHAR* end, NEXT next) { } template -static bool MatchPatternT(const CHAR* eval, const CHAR* eval_end, const CHAR* pattern, - const CHAR* pattern_end, int depth, NEXT next) { +bool MatchPatternT(const CHAR* eval, const CHAR* eval_end, const CHAR* pattern, + const CHAR* pattern_end, int depth, NEXT next) { const int kMaxDepth = 16; if (depth > kMaxDepth) return false; diff --git a/be/src/gutil/strings/util.h b/be/src/gutil/strings/util.h index 5aaa058f48..941fd5e91b 100644 --- a/be/src/gutil/strings/util.h +++ b/be/src/gutil/strings/util.h @@ -142,7 +142,7 @@ const char* strncaseprefix(const char* haystack, int haystack_size, const char* // char* literals). Templated so searching a const char* returns a const char*, // and searching a non-const char* returns a non-const char*. template -inline CharStar var_strprefix(CharStar str, const char* prefix) { +CharStar var_strprefix(CharStar str, const char* prefix) { const int len = strlen(prefix); return strncmp(str, prefix, len) == 0 ? str + len : NULL; } @@ -150,7 +150,7 @@ inline CharStar var_strprefix(CharStar str, const char* prefix) { // Same as var_strprefix() (immediately above), but matches a case-insensitive // prefix. template -inline CharStar var_strcaseprefix(CharStar str, const char* prefix) { +CharStar var_strcaseprefix(CharStar str, const char* prefix) { const int len = strlen(prefix); return strncasecmp(str, prefix, len) == 0 ? str + len : NULL; } diff --git a/be/src/olap/predicate_creator.h b/be/src/olap/predicate_creator.h index 931290021f..754a1ad503 100644 --- a/be/src/olap/predicate_creator.h +++ b/be/src/olap/predicate_creator.h @@ -152,7 +152,7 @@ private: }; template -inline std::unique_ptr> get_creator(const FieldType& type) { +std::unique_ptr> get_creator(const FieldType& type) { switch (type) { case OLAP_FIELD_TYPE_TINYINT: { return std::make_unique>(); @@ -237,25 +237,24 @@ inline std::unique_ptr> get_creator(const FieldT } template -inline ColumnPredicate* create_predicate(const TabletColumn& column, int index, - const ConditionType& conditions, bool opposite, - MemPool* pool) { +ColumnPredicate* create_predicate(const TabletColumn& column, int index, + const ConditionType& conditions, bool opposite, MemPool* pool) { return get_creator(column.type()) ->create(column, index, conditions, opposite, pool); } template -inline ColumnPredicate* create_comparison_predicate(const TabletColumn& column, int index, - const std::string& condition, bool opposite, - MemPool* pool) { +ColumnPredicate* create_comparison_predicate(const TabletColumn& column, int index, + const std::string& condition, bool opposite, + MemPool* pool) { static_assert(PredicateTypeTraits::is_comparison(PT)); return create_predicate(column, index, condition, opposite, pool); } template -inline ColumnPredicate* create_list_predicate(const TabletColumn& column, int index, - const std::vector& conditions, - bool opposite, MemPool* pool) { +ColumnPredicate* create_list_predicate(const TabletColumn& column, int index, + const std::vector& conditions, bool opposite, + MemPool* pool) { static_assert(PredicateTypeTraits::is_list(PT)); return create_predicate>(column, index, conditions, opposite, pool); diff --git a/be/src/olap/skiplist.h b/be/src/olap/skiplist.h index f960bb468e..771cca0e66 100644 --- a/be/src/olap/skiplist.h +++ b/be/src/olap/skiplist.h @@ -209,30 +209,30 @@ typename SkipList::Node* SkipList::NewNode(con } template -inline SkipList::Iterator::Iterator(const SkipList* list) { +SkipList::Iterator::Iterator(const SkipList* list) { list_ = list; node_ = nullptr; } template -inline bool SkipList::Iterator::Valid() const { +bool SkipList::Iterator::Valid() const { return node_ != nullptr; } template -inline const Key& SkipList::Iterator::key() const { +const Key& SkipList::Iterator::key() const { DCHECK(Valid()); return node_->key; } template -inline void SkipList::Iterator::Next() { +void SkipList::Iterator::Next() { DCHECK(Valid()); node_ = node_->Next(0); } template -inline void SkipList::Iterator::Prev() { +void SkipList::Iterator::Prev() { // Instead of using explicit "prev" links, we just search for the // last node that falls before key. DCHECK(Valid()); @@ -243,17 +243,17 @@ inline void SkipList::Iterator::Prev() { } template -inline void SkipList::Iterator::Seek(const Key& target) { +void SkipList::Iterator::Seek(const Key& target) { node_ = list_->FindGreaterOrEqual(target, nullptr); } template -inline void SkipList::Iterator::SeekToFirst() { +void SkipList::Iterator::SeekToFirst() { node_ = list_->head_->Next(0); } template -inline void SkipList::Iterator::SeekToLast() { +void SkipList::Iterator::SeekToLast() { node_ = list_->FindLast(); if (node_ == list_->head_) { node_ = nullptr; diff --git a/be/src/olap/types.cpp b/be/src/olap/types.cpp index f92c0c0da1..7d83e4ec30 100644 --- a/be/src/olap/types.cpp +++ b/be/src/olap/types.cpp @@ -106,7 +106,7 @@ const TypeInfo* get_scalar_type_info(FieldType field_type) { } template -inline const ArrayTypeInfo* get_init_array_type_info(int32_t iterations) { +const ArrayTypeInfo* get_init_array_type_info(int32_t iterations) { static ArrayTypeInfo nested_type_info_0( create_static_type_info_ptr(get_scalar_type_info())); static ArrayTypeInfo nested_type_info_1(create_static_type_info_ptr(&nested_type_info_0)); diff --git a/be/src/olap/types.h b/be/src/olap/types.h index b26a89ba6f..c9e61456dd 100644 --- a/be/src/olap/types.h +++ b/be/src/olap/types.h @@ -1398,7 +1398,7 @@ struct TypeTraits : public FieldTypeTraits { }; template -inline const TypeInfo* get_scalar_type_info() { +const TypeInfo* get_scalar_type_info() { static constexpr TypeTraits traits; static ScalarTypeInfo scalar_type_info(traits); return &scalar_type_info; diff --git a/be/src/olap/utils.h b/be/src/olap/utils.h index e63d998cce..fd98df50df 100644 --- a/be/src/olap/utils.h +++ b/be/src/olap/utils.h @@ -52,16 +52,16 @@ const static int32_t g_power_table[] = {1, 10, 100, 1000, 10 // 计时工具,用于确定一段代码执行的时间,用于性能调优 class OlapStopWatch { public: - uint64_t get_elapse_time_us() { + uint64_t get_elapse_time_us() const { struct timeval now; - gettimeofday(&now, 0); + gettimeofday(&now, nullptr); return (uint64_t)((now.tv_sec - _begin_time.tv_sec) * 1e6 + (now.tv_usec - _begin_time.tv_usec)); } - double get_elapse_second() { return get_elapse_time_us() / 1000000.0; } + double get_elapse_second() const { return get_elapse_time_us() / 1000000.0; } - void reset() { gettimeofday(&_begin_time, 0); } + void reset() { gettimeofday(&_begin_time, nullptr); } OlapStopWatch() { reset(); } diff --git a/be/src/runtime/exec_env.h b/be/src/runtime/exec_env.h index ae402453be..7fb7251df6 100644 --- a/be/src/runtime/exec_env.h +++ b/be/src/runtime/exec_env.h @@ -114,7 +114,7 @@ public: // using template to simplify client cache management template - ClientCache* get_client_cache() { + inline ClientCache* get_client_cache() { return nullptr; } diff --git a/be/src/runtime/memory/thread_mem_tracker_mgr.h b/be/src/runtime/memory/thread_mem_tracker_mgr.h index 5898f4c338..363d2e9361 100644 --- a/be/src/runtime/memory/thread_mem_tracker_mgr.h +++ b/be/src/runtime/memory/thread_mem_tracker_mgr.h @@ -203,7 +203,7 @@ inline bool ThreadMemTrackerMgr::try_consume(int64_t size) { } template -inline bool ThreadMemTrackerMgr::flush_untracked_mem() { +bool ThreadMemTrackerMgr::flush_untracked_mem() { // Temporary memory may be allocated during the consumption of the mem tracker, which will lead to entering // the Memory Hook again, so suspend consumption to avoid falling into an infinite loop. _stop_consume = true; diff --git a/be/src/service/point_query_executor.cpp b/be/src/service/point_query_executor.cpp index e33a7a186b..1db2881007 100644 --- a/be/src/service/point_query_executor.cpp +++ b/be/src/service/point_query_executor.cpp @@ -278,8 +278,8 @@ Status PointQueryExecutor::_lookup_row_data() { } template -static Status _serialize_block(MysqlWriter& mysql_writer, vectorized::Block& block, - PTabletKeyLookupResponse* response) { +Status _serialize_block(MysqlWriter& mysql_writer, vectorized::Block& block, + PTabletKeyLookupResponse* response) { RETURN_IF_ERROR(mysql_writer.append_block(block)); assert(mysql_writer.results().size() == 1); uint8_t* buf = nullptr; diff --git a/be/src/util/binary_cast.hpp b/be/src/util/binary_cast.hpp index 17754a15e9..df9190a55c 100644 --- a/be/src/util/binary_cast.hpp +++ b/be/src/util/binary_cast.hpp @@ -37,7 +37,7 @@ union TypeConverter { }; template -inline constexpr bool match_v = std::is_same_v && std::is_same_v; +constexpr bool match_v = std::is_same_v && std::is_same_v; union DecimalInt128Union { DecimalV2Value decimal; diff --git a/be/src/util/bit_packing.inline.h b/be/src/util/bit_packing.inline.h index 118d4edaa2..ed578868bd 100644 --- a/be/src/util/bit_packing.inline.h +++ b/be/src/util/bit_packing.inline.h @@ -172,7 +172,7 @@ std::pair BitPacking::UnpackAndDecodeValues( // avoid buffer overflow (if we are unpacking 32 values, we can safely assume an input // buffer of length 32 * BIT_WIDTH). template -inline uint64_t ALWAYS_INLINE UnpackValue(const uint8_t* __restrict__ in_buf) { +uint64_t UnpackValue(const uint8_t* __restrict__ in_buf) { if (BIT_WIDTH == 0) return 0; constexpr int FIRST_BIT_IDX = VALUE_IDX * BIT_WIDTH; @@ -220,9 +220,8 @@ inline uint64_t ALWAYS_INLINE UnpackValue(const uint8_t* __restrict__ in_buf) { } template -inline void ALWAYS_INLINE DecodeValue(OutType* __restrict__ dict, int64_t dict_len, uint32_t idx, - OutType* __restrict__ out_val, - bool* __restrict__ decode_error) { +void DecodeValue(OutType* __restrict__ dict, int64_t dict_len, uint32_t idx, + OutType* __restrict__ out_val, bool* __restrict__ decode_error) { if (UNLIKELY(idx >= dict_len)) { *decode_error = true; } else { diff --git a/be/src/util/bit_stream_utils.inline.h b/be/src/util/bit_stream_utils.inline.h index fb62e9e3ae..24dabe9e67 100644 --- a/be/src/util/bit_stream_utils.inline.h +++ b/be/src/util/bit_stream_utils.inline.h @@ -80,7 +80,7 @@ inline uint8_t* BitWriter::GetNextBytePtr(int num_bytes) { } template -inline void BitWriter::PutAligned(T val, int num_bytes) { +void BitWriter::PutAligned(T val, int num_bytes) { DCHECK_LE(num_bytes, sizeof(T)); uint8_t* ptr = GetNextBytePtr(num_bytes); memcpy(ptr, &val, num_bytes); @@ -114,7 +114,7 @@ inline void BitReader::BufferValues() { } template -inline bool BitReader::GetValue(int num_bits, T* v) { +bool BitReader::GetValue(int num_bits, T* v) { DCHECK_LE(num_bits, 64); DCHECK_LE(num_bits, sizeof(T) * 8); @@ -187,7 +187,7 @@ inline void BitReader::SeekToBit(unsigned int stream_position) { } template -inline bool BitReader::GetAligned(int num_bytes, T* v) { +bool BitReader::GetAligned(int num_bytes, T* v) { DCHECK_LE(num_bytes, sizeof(T)); int bytes_read = BitUtil::Ceil(bit_offset_, 8); if (PREDICT_FALSE(byte_offset_ + bytes_read + num_bytes > max_bytes_)) return false; @@ -258,7 +258,7 @@ inline bool BitReader::GetZigZagVlqInt(int64_t* v) { } template -inline int BatchedBitReader::UnpackBatch(int bit_width, int num_values, T* v) { +int BatchedBitReader::UnpackBatch(int bit_width, int num_values, T* v) { DCHECK(buffer_pos_ != nullptr); DCHECK_GE(bit_width, 0); DCHECK_LE(bit_width, MAX_BITWIDTH); @@ -288,8 +288,8 @@ inline bool BatchedBitReader::SkipBatch(int bit_width, int num_values_to_skip) { } template -inline int BatchedBitReader::UnpackAndDecodeBatch(int bit_width, T* dict, int64_t dict_len, - int num_values, T* v, int64_t stride) { +int BatchedBitReader::UnpackAndDecodeBatch(int bit_width, T* dict, int64_t dict_len, int num_values, + T* v, int64_t stride) { DCHECK(buffer_pos_ != nullptr); DCHECK_GE(bit_width, 0); DCHECK_LE(bit_width, MAX_BITWIDTH); @@ -309,7 +309,7 @@ inline int BatchedBitReader::UnpackAndDecodeBatch(int bit_width, T* dict, int64_ } template -inline bool BatchedBitReader::GetBytes(int num_bytes, T* v) { +bool BatchedBitReader::GetBytes(int num_bytes, T* v) { DCHECK(buffer_pos_ != nullptr); DCHECK_GE(num_bytes, 0); DCHECK_LE(num_bytes, sizeof(T)); @@ -321,7 +321,7 @@ inline bool BatchedBitReader::GetBytes(int num_bytes, T* v) { } template -inline bool BatchedBitReader::GetUleb128(UINT_T* v) { +bool BatchedBitReader::GetUleb128(UINT_T* v) { static_assert(std::is_integral::value, "Integral type required."); static_assert(std::is_unsigned::value, "Unsigned type required."); static_assert(!std::is_same::value, "Bools are not supported."); diff --git a/be/src/util/bitmap_intersect.h b/be/src/util/bitmap_intersect.h index 5de40232c5..8258ee21eb 100644 --- a/be/src/util/bitmap_intersect.h +++ b/be/src/util/bitmap_intersect.h @@ -55,7 +55,7 @@ public: }; template <> -inline char* Helper::write_to(const DateTimeValue& v, char* dest) { +char* Helper::write_to(const DateTimeValue& v, char* dest) { DateTimeVal value; v.to_datetime_val(&value); *(int64_t*)dest = value.packed_time; @@ -66,7 +66,7 @@ inline char* Helper::write_to(const DateTimeValue& v, char* dest) } template <> -inline char* Helper::write_to(const DecimalV2Value& v, char* dest) { +char* Helper::write_to(const DecimalV2Value& v, char* dest) { __int128 value = v.value(); memcpy(dest, &value, DECIMAL_BYTE_SIZE); dest += DECIMAL_BYTE_SIZE; @@ -74,7 +74,7 @@ inline char* Helper::write_to(const DecimalV2Value& v, char* des } template <> -inline char* Helper::write_to(const StringRef& v, char* dest) { +char* Helper::write_to(const StringRef& v, char* dest) { *(int32_t*)dest = v.size; dest += 4; memcpy(dest, v.data, v.size); @@ -83,7 +83,7 @@ inline char* Helper::write_to(const StringRef& v, char* dest) { } template <> -inline char* Helper::write_to(const std::string& v, char* dest) { +char* Helper::write_to(const std::string& v, char* dest) { *(uint32_t*)dest = v.size(); dest += 4; memcpy(dest, v.c_str(), v.size()); @@ -93,28 +93,28 @@ inline char* Helper::write_to(const std::string& v, char* dest) { // write_to end template <> -inline int32_t Helper::serialize_size(const DateTimeValue& v) { +int32_t Helper::serialize_size(const DateTimeValue& v) { return Helper::DATETIME_PACKED_TIME_BYTE_SIZE + Helper::DATETIME_TYPE_BYTE_SIZE; } template <> -inline int32_t Helper::serialize_size(const DecimalV2Value& v) { +int32_t Helper::serialize_size(const DecimalV2Value& v) { return Helper::DECIMAL_BYTE_SIZE; } template <> -inline int32_t Helper::serialize_size(const StringRef& v) { +int32_t Helper::serialize_size(const StringRef& v) { return v.size + 4; } template <> -inline int32_t Helper::serialize_size(const std::string& v) { +int32_t Helper::serialize_size(const std::string& v) { return v.size() + 4; } // serialize_size end template <> -inline void Helper::read_from(const char** src, DateTimeValue* result) { +void Helper::read_from(const char** src, DateTimeValue* result) { DateTimeVal value; value.is_null = false; value.packed_time = *(int64_t*)(*src); @@ -125,7 +125,7 @@ inline void Helper::read_from(const char** src, DateTimeValue* re } template <> -inline void Helper::read_from(const char** src, DecimalV2Value* result) { +void Helper::read_from(const char** src, DecimalV2Value* result) { __int128 v = 0; memcpy(&v, *src, DECIMAL_BYTE_SIZE); *src += DECIMAL_BYTE_SIZE; @@ -133,7 +133,7 @@ inline void Helper::read_from(const char** src, DecimalV2Value* } template <> -inline void Helper::read_from(const char** src, StringRef* result) { +void Helper::read_from(const char** src, StringRef* result) { int32_t length = *(int32_t*)(*src); *src += 4; *result = StringRef((char*)*src, length); @@ -141,7 +141,7 @@ inline void Helper::read_from(const char** src, StringRef* result) { } template <> -inline void Helper::read_from(const char** src, std::string* result) { +void Helper::read_from(const char** src, std::string* result) { int32_t length = *(int32_t*)(*src); *src += 4; *result = std::string((char*)*src, length); diff --git a/be/src/util/coding.h b/be/src/util/coding.h index 3cfa8e76b4..16b89507b2 100644 --- a/be/src/util/coding.h +++ b/be/src/util/coding.h @@ -105,14 +105,14 @@ inline uint128_t decode_fixed128_le(const uint8_t* buf) { } template -inline void put_fixed32_le(T* dst, uint32_t val) { +void put_fixed32_le(T* dst, uint32_t val) { uint8_t buf[sizeof(val)]; encode_fixed32_le(buf, val); dst->append((char*)buf, sizeof(buf)); } template -inline void put_fixed64_le(T* dst, uint64_t val) { +void put_fixed64_le(T* dst, uint64_t val) { uint8_t buf[sizeof(val)]; encode_fixed64_le(buf, val); dst->append((char*)buf, sizeof(buf)); @@ -129,7 +129,7 @@ inline int varint_length(uint64_t v) { } template -inline void put_fixed128_le(T* dst, uint128_t val) { +void put_fixed128_le(T* dst, uint128_t val) { uint8_t buf[sizeof(val)]; encode_fixed128_le(buf, val); dst->append((char*)buf, sizeof(buf)); @@ -169,27 +169,27 @@ inline const uint8_t* decode_varint32_ptr(const uint8_t* ptr, const uint8_t* lim extern const uint8_t* decode_varint64_ptr(const uint8_t* p, const uint8_t* limit, uint64_t* value); template -inline void put_varint32(T* dst, uint32_t v) { +void put_varint32(T* dst, uint32_t v) { uint8_t buf[16]; uint8_t* ptr = encode_varint32(buf, v); dst->append((char*)buf, static_cast(ptr - buf)); } template -inline void put_varint64(T* dst, uint64_t v) { +void put_varint64(T* dst, uint64_t v) { uint8_t buf[16]; uint8_t* ptr = encode_varint64(buf, v); dst->append((char*)buf, static_cast(ptr - buf)); } template -inline void put_length_prefixed_slice(T* dst, const Slice& value) { +void put_length_prefixed_slice(T* dst, const Slice& value) { put_varint32(dst, value.get_size()); dst->append(value.get_data(), value.get_size()); } template -inline void put_varint64_varint32(T* dst, uint64_t v1, uint32_t v2) { +void put_varint64_varint32(T* dst, uint64_t v1, uint32_t v2) { uint8_t buf[16]; uint8_t* ptr = encode_varint64(buf, v1); ptr = encode_varint32(ptr, v2); diff --git a/be/src/util/frame_of_reference_coding.h b/be/src/util/frame_of_reference_coding.h index bab0dca0ef..da3d716e75 100644 --- a/be/src/util/frame_of_reference_coding.h +++ b/be/src/util/frame_of_reference_coding.h @@ -29,12 +29,12 @@ namespace doris { -static inline uint8_t bits_less_than_64(const uint64_t v) { +inline uint8_t bits_less_than_64(const uint64_t v) { return v == 0 ? 0 : 64 - __builtin_clzll(v); } // See https://stackoverflow.com/questions/28423405/counting-the-number-of-leading-zeros-in-a-128-bit-integer -static inline uint8_t bits_may_more_than_64(const uint128_t v) { +inline uint8_t bits_may_more_than_64(const uint128_t v) { uint64_t hi = v >> 64; uint64_t lo = v; int z[3] = {__builtin_clzll(hi), __builtin_clzll(lo) + 64, 128}; @@ -43,7 +43,7 @@ static inline uint8_t bits_may_more_than_64(const uint128_t v) { } template -static inline uint8_t bits(const T v) { +uint8_t bits(const T v) { if (sizeof(T) <= 8) { return bits_less_than_64(v); } else { diff --git a/be/src/util/interval_tree-inl.h b/be/src/util/interval_tree-inl.h index d322d260d5..f93dd788a6 100644 --- a/be/src/util/interval_tree-inl.h +++ b/be/src/util/interval_tree-inl.h @@ -70,7 +70,7 @@ void IntervalTree::FindIntersectingInterval(const QueryPointType& lower_ } template -static bool LessThan(const typename Traits::point_type& a, const typename Traits::point_type& b) { +bool LessThan(const typename Traits::point_type& a, const typename Traits::point_type& b) { return Traits::compare(a, b) < 0; } diff --git a/be/src/util/mysql_row_buffer.cpp b/be/src/util/mysql_row_buffer.cpp index 04f5519a6d..3473d525bd 100644 --- a/be/src/util/mysql_row_buffer.cpp +++ b/be/src/util/mysql_row_buffer.cpp @@ -146,7 +146,7 @@ int MysqlRowBuffer::reserve(int64_t size) { } template -static char* add_int(T data, char* pos, bool dynamic_mode) { +char* add_int(T data, char* pos, bool dynamic_mode) { auto fi = fmt::format_int(data); int length = fi.size(); if (!dynamic_mode) { @@ -165,7 +165,7 @@ static char* add_largeint(int128_t data, char* pos, bool dynamic_mode) { } template -static char* add_float(T data, char* pos, bool dynamic_mode) { +char* add_float(T data, char* pos, bool dynamic_mode) { int length = 0; if constexpr (std::is_same_v) { length = FastFloatToBuffer(data, pos + !dynamic_mode); diff --git a/be/src/util/proto_util.h b/be/src/util/proto_util.h index f7d8e1ef09..79a1e0866c 100644 --- a/be/src/util/proto_util.h +++ b/be/src/util/proto_util.h @@ -39,7 +39,7 @@ constexpr size_t MIN_HTTP_BRPC_SIZE = (1ULL << 31); // Embed column_values and brpc request serialization string in controller attachment. template -inline Status request_embed_attachment_contain_block(Params* brpc_request, Closure* closure) { +Status request_embed_attachment_contain_block(Params* brpc_request, Closure* closure) { auto block = brpc_request->block(); Status st = request_embed_attachment(brpc_request, block.column_values(), closure); block.set_column_values(""); @@ -62,15 +62,15 @@ inline bool enable_http_send_block( } template -inline void transmit_block(PBackendService_Stub& stub, Closure* closure, - const PTransmitDataParams& params) { +void transmit_block(PBackendService_Stub& stub, Closure* closure, + const PTransmitDataParams& params) { closure->cntl.http_request().Clear(); stub.transmit_block(&closure->cntl, ¶ms, &closure->result, closure); } template -inline Status transmit_block_http(RuntimeState* state, Closure* closure, - PTransmitDataParams& params, TNetworkAddress brpc_dest_addr) { +Status transmit_block_http(RuntimeState* state, Closure* closure, PTransmitDataParams& params, + TNetworkAddress brpc_dest_addr) { RETURN_IF_ERROR(request_embed_attachment_contain_block(¶ms, closure)); //format an ipv6 address @@ -92,8 +92,8 @@ inline Status transmit_block_http(RuntimeState* state, Closure* closure, // This can avoid reaching the upper limit of the ProtoBuf Request length (2G), // and it is expected that performance can be improved. template -inline void request_row_batch_transfer_attachment(Params* brpc_request, - const std::string& tuple_data, Closure* closure) { +void request_row_batch_transfer_attachment(Params* brpc_request, const std::string& tuple_data, + Closure* closure) { auto row_batch = brpc_request->mutable_row_batch(); row_batch->set_tuple_data(""); brpc_request->set_transfer_by_attachment(true); @@ -107,8 +107,8 @@ inline void request_row_batch_transfer_attachment(Params* brpc_request, // This can avoid reaching the upper limit of the ProtoBuf Request length (2G), // and it is expected that performance can be improved. template -inline void request_block_transfer_attachment(Params* brpc_request, - const std::string& column_values, Closure* closure) { +void request_block_transfer_attachment(Params* brpc_request, const std::string& column_values, + Closure* closure) { auto block = brpc_request->mutable_block(); block->set_column_values(""); brpc_request->set_transfer_by_attachment(true); @@ -120,8 +120,7 @@ inline void request_block_transfer_attachment(Params* brpc_request, // TODO(zxy) delete in v1.3 version // Controller Attachment transferred to RowBatch in ProtoBuf Request. template -inline void attachment_transfer_request_row_batch(const Params* brpc_request, - brpc::Controller* cntl) { +void attachment_transfer_request_row_batch(const Params* brpc_request, brpc::Controller* cntl) { Params* req = const_cast(brpc_request); if (req->has_row_batch() && req->transfer_by_attachment()) { auto rb = req->mutable_row_batch(); @@ -134,7 +133,7 @@ inline void attachment_transfer_request_row_batch(const Params* brpc_request, // TODO(zxy) delete in v1.3 version // Controller Attachment transferred to Block in ProtoBuf Request. template -inline void attachment_transfer_request_block(const Params* brpc_request, brpc::Controller* cntl) { +void attachment_transfer_request_block(const Params* brpc_request, brpc::Controller* cntl) { Params* req = const_cast(brpc_request); if (req->has_block() && req->transfer_by_attachment()) { auto block = req->mutable_block(); @@ -145,8 +144,7 @@ inline void attachment_transfer_request_block(const Params* brpc_request, brpc:: } template -inline Status request_embed_attachment(Params* brpc_request, const std::string& data, - Closure* closure) { +Status request_embed_attachment(Params* brpc_request, const std::string& data, Closure* closure) { butil::IOBuf attachment; // step1: serialize brpc_request to string, and append to attachment. @@ -177,16 +175,16 @@ inline Status request_embed_attachment(Params* brpc_request, const std::string& // Extract the brpc request and block from the controller attachment, // and put the block into the request. template -inline Status attachment_extract_request_contain_block(const Params* brpc_request, - brpc::Controller* cntl) { +Status attachment_extract_request_contain_block(const Params* brpc_request, + brpc::Controller* cntl) { Params* req = const_cast(brpc_request); auto block = req->mutable_block(); return attachment_extract_request(req, cntl, block->mutable_column_values()); } template -inline Status attachment_extract_request(const Params* brpc_request, brpc::Controller* cntl, - std::string* data) { +Status attachment_extract_request(const Params* brpc_request, brpc::Controller* cntl, + std::string* data) { const butil::IOBuf& io_buf = cntl->request_attachment(); // step1: deserialize request string to brpc_request from attachment. diff --git a/be/src/util/rle_encoding.h b/be/src/util/rle_encoding.h index 1e83599265..21f8ee428e 100644 --- a/be/src/util/rle_encoding.h +++ b/be/src/util/rle_encoding.h @@ -224,7 +224,7 @@ private: }; template -inline bool RleDecoder::ReadHeader() { +bool RleDecoder::ReadHeader() { DCHECK(bit_reader_.is_initialized()); if (PREDICT_FALSE(literal_count_ == 0 && repeat_count_ == 0)) { // Read the next run's indicator int, it could be a literal or repeated run @@ -252,7 +252,7 @@ inline bool RleDecoder::ReadHeader() { } template -inline bool RleDecoder::Get(T* val) { +bool RleDecoder::Get(T* val) { DCHECK(bit_reader_.is_initialized()); if (PREDICT_FALSE(!ReadHeader())) { return false; @@ -274,7 +274,7 @@ inline bool RleDecoder::Get(T* val) { } template -inline void RleDecoder::RewindOne() { +void RleDecoder::RewindOne() { DCHECK(bit_reader_.is_initialized()); switch (rewind_state_) { @@ -295,7 +295,7 @@ inline void RleDecoder::RewindOne() { } template -inline size_t RleDecoder::GetNextRun(T* val, size_t max_run) { +size_t RleDecoder::GetNextRun(T* val, size_t max_run) { DCHECK(bit_reader_.is_initialized()); DCHECK_GT(max_run, 0); size_t ret = 0; @@ -343,7 +343,7 @@ inline size_t RleDecoder::GetNextRun(T* val, size_t max_run) { } template -inline size_t RleDecoder::get_values(T* values, size_t num_values) { +size_t RleDecoder::get_values(T* values, size_t num_values) { size_t read_num = 0; while (read_num < num_values) { size_t read_this_time = num_values - read_num; @@ -373,7 +373,7 @@ inline size_t RleDecoder::get_values(T* values, size_t num_values) { } template -inline size_t RleDecoder::repeated_count() { +size_t RleDecoder::repeated_count() { if (repeat_count_ > 0) { return repeat_count_; } @@ -384,14 +384,14 @@ inline size_t RleDecoder::repeated_count() { } template -inline T RleDecoder::get_repeated_value(size_t count) { +T RleDecoder::get_repeated_value(size_t count) { DCHECK_GE(repeat_count_, count); repeat_count_ -= count; return current_value_; } template -inline size_t RleDecoder::Skip(size_t to_skip) { +size_t RleDecoder::Skip(size_t to_skip) { DCHECK(bit_reader_.is_initialized()); size_t set_count = 0; @@ -427,7 +427,7 @@ inline size_t RleDecoder::Skip(size_t to_skip) { // This function buffers input values 8 at a time. After seeing all 8 values, // it decides whether they should be encoded as a literal or repeated run. template -inline void RleEncoder::Put(T value, size_t run_length) { +void RleEncoder::Put(T value, size_t run_length) { DCHECK(bit_width_ == 64 || value < (1LL << bit_width_)); // TODO(perf): remove the loop and use the repeat_count_ @@ -460,7 +460,7 @@ inline void RleEncoder::Put(T value, size_t run_length) { } template -inline void RleEncoder::FlushLiteralRun(bool update_indicator_byte) { +void RleEncoder::FlushLiteralRun(bool update_indicator_byte) { if (literal_indicator_byte_idx_ < 0) { // The literal indicator byte has not been reserved yet, get one now. literal_indicator_byte_idx_ = bit_writer_.GetByteIndexAndAdvance(1); @@ -488,7 +488,7 @@ inline void RleEncoder::FlushLiteralRun(bool update_indicator_byte) { } template -inline void RleEncoder::FlushRepeatedRun() { +void RleEncoder::FlushRepeatedRun() { DCHECK_GT(repeat_count_, 0); // The lsb of 0 indicates this is a repeated run int32_t indicator_value = repeat_count_ << 1 | 0; @@ -501,7 +501,7 @@ inline void RleEncoder::FlushRepeatedRun() { // Flush the values that have been buffered. At this point we decide whether // we need to switch between the run types or continue the current one. template -inline void RleEncoder::FlushBufferedValues(bool done) { +void RleEncoder::FlushBufferedValues(bool done) { if (repeat_count_ >= 8) { // Clear the buffered values. They are part of the repeated run now and we // don't want to flush them out as literals. @@ -531,14 +531,14 @@ inline void RleEncoder::FlushBufferedValues(bool done) { } template -inline void RleEncoder::Reserve(int num_bytes, uint8_t val) { +void RleEncoder::Reserve(int num_bytes, uint8_t val) { for (int i = 0; i < num_bytes; ++i) { bit_writer_.PutValue(val, 8); } } template -inline int RleEncoder::Flush() { +int RleEncoder::Flush() { if (literal_count_ > 0 || repeat_count_ > 0 || num_buffered_values_ > 0) { bool all_repeat = literal_count_ == 0 && (repeat_count_ == num_buffered_values_ || num_buffered_values_ == 0); @@ -559,7 +559,7 @@ inline int RleEncoder::Flush() { } template -inline void RleEncoder::Clear() { +void RleEncoder::Clear() { current_value_ = 0; repeat_count_ = 0; num_buffered_values_ = 0; @@ -720,7 +720,7 @@ private: }; template -inline int32_t RleBatchDecoder::OutputBufferedLiterals(int32_t max_to_output, T* values) { +int32_t RleBatchDecoder::OutputBufferedLiterals(int32_t max_to_output, T* values) { int32_t num_to_output = std::min(max_to_output, num_buffered_literals_ - literal_buffer_pos_); memcpy(values, &literal_buffer_[literal_buffer_pos_], sizeof(T) * num_to_output); @@ -730,7 +730,7 @@ inline int32_t RleBatchDecoder::OutputBufferedLiterals(int32_t max_to_output, } template -inline void RleBatchDecoder::Reset(uint8_t* buffer, int buffer_len, int bit_width) { +void RleBatchDecoder::Reset(uint8_t* buffer, int buffer_len, int bit_width) { bit_reader_.Reset(buffer, buffer_len); bit_width_ = bit_width; repeat_count_ = 0; @@ -740,14 +740,14 @@ inline void RleBatchDecoder::Reset(uint8_t* buffer, int buffer_len, int bit_w } template -inline int32_t RleBatchDecoder::NextNumRepeats() { +int32_t RleBatchDecoder::NextNumRepeats() { if (repeat_count_ > 0) return repeat_count_; if (literal_count_ == 0) NextCounts(); return repeat_count_; } template -inline void RleBatchDecoder::NextCounts() { +void RleBatchDecoder::NextCounts() { // Read the next run's indicator int, it could be a literal or repeated run. // The int is encoded as a ULEB128-encoded value. uint32_t indicator_value = 0; @@ -775,20 +775,20 @@ inline void RleBatchDecoder::NextCounts() { } template -inline T RleBatchDecoder::GetRepeatedValue(int32_t num_repeats_to_consume) { +T RleBatchDecoder::GetRepeatedValue(int32_t num_repeats_to_consume) { repeat_count_ -= num_repeats_to_consume; return repeated_value_; } template -inline int32_t RleBatchDecoder::NextNumLiterals() { +int32_t RleBatchDecoder::NextNumLiterals() { if (literal_count_ > 0) return literal_count_; if (repeat_count_ == 0) NextCounts(); return literal_count_; } template -inline bool RleBatchDecoder::GetLiteralValues(int32_t num_literals_to_consume, T* values) { +bool RleBatchDecoder::GetLiteralValues(int32_t num_literals_to_consume, T* values) { int32_t num_consumed = 0; // Copy any buffered literals left over from previous calls. if (HaveBufferedLiterals()) { @@ -820,7 +820,7 @@ inline bool RleBatchDecoder::GetLiteralValues(int32_t num_literals_to_consume } template -inline bool RleBatchDecoder::FillLiteralBuffer() { +bool RleBatchDecoder::FillLiteralBuffer() { int32_t num_to_buffer = std::min(LITERAL_BUFFER_LEN, literal_count_); num_buffered_literals_ = bit_reader_.UnpackBatch(bit_width_, num_to_buffer, literal_buffer_); // If we couldn't read the expected number, that means the input was truncated. @@ -830,7 +830,7 @@ inline bool RleBatchDecoder::FillLiteralBuffer() { } template -inline int32_t RleBatchDecoder::GetBatch(T* values, int32_t batch_num) { +int32_t RleBatchDecoder::GetBatch(T* values, int32_t batch_num) { int32_t num_consumed = 0; while (num_consumed < batch_num) { // Add RLE encoded values by repeating the current value this number of times. diff --git a/be/src/util/simd/bits.h b/be/src/util/simd/bits.h index 4f4fe65414..03d876b971 100644 --- a/be/src/util/simd/bits.h +++ b/be/src/util/simd/bits.h @@ -101,7 +101,7 @@ inline size_t count_zero_num(const int8_t* __restrict data, const uint8_t* __res // TODO: compare with different SIMD implements template -inline static size_t find_byte(const std::vector& vec, size_t start, T byte) { +static size_t find_byte(const std::vector& vec, size_t start, T byte) { if (start >= vec.size()) { return start; } @@ -113,7 +113,7 @@ inline static size_t find_byte(const std::vector& vec, size_t start, T byte) } template -inline bool contain_byte(const T* __restrict data, const size_t length, const signed char byte) { +bool contain_byte(const T* __restrict data, const size_t length, const signed char byte) { return nullptr != std::memchr(reinterpret_cast(data), byte, length); } diff --git a/be/src/util/string_parser.hpp b/be/src/util/string_parser.hpp index 7136f6bb94..ff473bf401 100644 --- a/be/src/util/string_parser.hpp +++ b/be/src/util/string_parser.hpp @@ -227,7 +227,7 @@ private: }; // end of class StringParser template -inline T StringParser::string_to_int_internal(const char* s, int len, ParseResult* result) { +T StringParser::string_to_int_internal(const char* s, int len, ParseResult* result) { if (UNLIKELY(len <= 0)) { *result = PARSE_FAILURE; return 0; @@ -283,8 +283,7 @@ inline T StringParser::string_to_int_internal(const char* s, int len, ParseResul } template -inline T StringParser::string_to_unsigned_int_internal(const char* s, int len, - ParseResult* result) { +T StringParser::string_to_unsigned_int_internal(const char* s, int len, ParseResult* result) { if (UNLIKELY(len <= 0)) { *result = PARSE_FAILURE; return 0; @@ -331,8 +330,7 @@ inline T StringParser::string_to_unsigned_int_internal(const char* s, int len, } template -inline T StringParser::string_to_int_internal(const char* s, int len, int base, - ParseResult* result) { +T StringParser::string_to_int_internal(const char* s, int len, int base, ParseResult* result) { typedef typename std::make_unsigned::type UnsignedT; UnsignedT val = 0; UnsignedT max_val = StringParser::numeric_limits(false); @@ -391,7 +389,7 @@ inline T StringParser::string_to_int_internal(const char* s, int len, int base, } template -inline T StringParser::string_to_int_no_overflow(const char* s, int len, ParseResult* result) { +T StringParser::string_to_int_no_overflow(const char* s, int len, ParseResult* result) { T val = 0; if (UNLIKELY(len == 0)) { *result = PARSE_SUCCESS; @@ -422,7 +420,7 @@ inline T StringParser::string_to_int_no_overflow(const char* s, int len, ParseRe } template -inline T StringParser::string_to_float_internal(const char* s, int len, ParseResult* result) { +T StringParser::string_to_float_internal(const char* s, int len, ParseResult* result) { int i = 0; // skip leading spaces for (; i < len; ++i) { @@ -548,8 +546,8 @@ inline int StringParser::StringParseTraits<__int128>::max_ascii_len() { } template -inline T StringParser::string_to_decimal(const char* s, int len, int type_precision, int type_scale, - ParseResult* result) { +T StringParser::string_to_decimal(const char* s, int len, int type_precision, int type_scale, + ParseResult* result) { // Special cases: // 1) '' == Fail, an empty string fails to parse. // 2) ' # ' == #, leading and trailing white space is ignored. diff --git a/be/src/util/string_util.h b/be/src/util/string_util.h index ac19448164..b0bfdbd7e9 100644 --- a/be/src/util/string_util.h +++ b/be/src/util/string_util.h @@ -79,7 +79,7 @@ inline std::vector split(const std::string& s, const std::string& d } template -inline std::string join(const std::vector& elems, const std::string& delim) { +std::string join(const std::vector& elems, const std::string& delim) { std::stringstream ss; for (size_t i = 0; i < elems.size(); ++i) { if (i != 0) { @@ -131,14 +131,14 @@ using StringCaseUnorderedMap = std::unordered_map; template -inline auto get_json_token(T& path_string) { +auto get_json_token(T& path_string) { return boost::tokenizer>( path_string, boost::escaped_list_separator("\\", ".", "\"")); } #ifdef USE_LIBCPP template <> -inline auto get_json_token(std::string_view& path_string) = delete; +auto get_json_token(std::string_view& path_string) = delete; #endif } // namespace doris diff --git a/be/src/util/type_traits.h b/be/src/util/type_traits.h index dafa20f2d0..9f41234d7e 100644 --- a/be/src/util/type_traits.h +++ b/be/src/util/type_traits.h @@ -29,12 +29,12 @@ template