diff --git a/.clang-tidy b/.clang-tidy index ee5d054602c..8746003136a 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -70,6 +70,7 @@ Checks: '-*, -bugprone-assignment-in-if-condition, -bugprone-branch-clone, -bugprone-casting-through-void, + -bugprone-crtp-constructor-accessibility, -bugprone-easily-swappable-parameters, -bugprone-empty-catch, -bugprone-exception-escape, @@ -80,8 +81,10 @@ Checks: '-*, -bugprone-narrowing-conversions, -bugprone-not-null-terminated-result, -bugprone-reserved-identifier, + -bugprone-return-const-ref-from-parameter, -bugprone-signed-char-misuse, -bugprone-sizeof-expression, + -bugprone-suspicious-stringview-data-usage, -bugprone-switch-missing-default-case, -bugprone-too-small-loop-variable, -bugprone-unchecked-optional-access, @@ -92,6 +95,7 @@ Checks: '-*, performance-*, -performance-avoid-endl, -performance-enum-size, + -performance-inefficient-vector-operation, -performance-no-automatic-move, -performance-no-int-to-ptr, -performance-noexcept-swap, @@ -140,7 +144,7 @@ Checks: '-*, readability-duplicate-include, readability-function-size, readability-inconsistent-declaration-parameter-name, - readability-math-missing-parentheses, + -readability-math-missing-parentheses, readability-misleading-indentation, readability-misplaced-array-index, readability-redundant-access-specifiers, diff --git a/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc b/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc index 968386bec8a..4420986c02e 100644 --- a/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc +++ b/src/core/ext/filters/channel_idle/legacy_channel_idle_filter.cc @@ -220,7 +220,7 @@ ArenaPromise LegacyChannelIdleFilter::MakeCallPromise( return ArenaPromise( [decrementer = Decrementer(this), next = next_promise_factory(std::move(call_args))]() mutable - -> Poll { return next(); }); + -> Poll { return next(); }); } bool LegacyChannelIdleFilter::StartTransportOp(grpc_transport_op* op) { diff --git a/src/core/ext/filters/http/message_compress/compression_filter.cc b/src/core/ext/filters/http/message_compress/compression_filter.cc index fe7123db78f..002886f6f33 100644 --- a/src/core/ext/filters/http/message_compress/compression_filter.cc +++ b/src/core/ext/filters/http/message_compress/compression_filter.cc @@ -136,8 +136,8 @@ MessageHandle ChannelCompression::CompressMessage( const char* algo_name; const size_t before_size = payload->Length(); const size_t after_size = tmp.Length(); - const float savings_ratio = 1.0f - static_cast(after_size) / - static_cast(before_size); + const float savings_ratio = 1.0f - (static_cast(after_size) / + static_cast(before_size)); CHECK(grpc_compression_algorithm_name(algorithm, &algo_name)); LOG(INFO) << absl::StrFormat( "Compressed[%s] %" PRIuPTR " bytes vs. %" PRIuPTR diff --git a/src/core/ext/transport/chaotic_good/chaotic_good_transport.h b/src/core/ext/transport/chaotic_good/chaotic_good_transport.h index 3616797a3bb..336395dc72d 100644 --- a/src/core/ext/transport/chaotic_good/chaotic_good_transport.h +++ b/src/core/ext/transport/chaotic_good/chaotic_good_transport.h @@ -108,10 +108,11 @@ class ChaoticGoodTransport : public RefCounted { }); }, [&frame_header]() { - return [status = frame_header.status()]() mutable - -> absl::StatusOr> { - return std::move(status); - }; + return + [status = frame_header.status()]() mutable + -> absl::StatusOr> { + return std::move(status); + }; }); }); } diff --git a/src/core/ext/transport/chaotic_good/server_transport.cc b/src/core/ext/transport/chaotic_good/server_transport.cc index 43ad407384c..adf03718deb 100644 --- a/src/core/ext/transport/chaotic_good/server_transport.cc +++ b/src/core/ext/transport/chaotic_good/server_transport.cc @@ -176,7 +176,7 @@ auto ChaoticGoodServerTransport::SendCallBody( const uint32_t padding = message_length % aligned_bytes == 0 ? 0 - : aligned_bytes - message_length % aligned_bytes; + : aligned_bytes - (message_length % aligned_bytes); CHECK_EQ((message_length + padding) % aligned_bytes, 0u); frame.message = FragmentMessage(std::move(message), padding, message_length); diff --git a/src/core/ext/transport/chaotic_good_legacy/chaotic_good_transport.h b/src/core/ext/transport/chaotic_good_legacy/chaotic_good_transport.h index fb3b100c0cf..e15855a5598 100644 --- a/src/core/ext/transport/chaotic_good_legacy/chaotic_good_transport.h +++ b/src/core/ext/transport/chaotic_good_legacy/chaotic_good_transport.h @@ -108,10 +108,11 @@ class ChaoticGoodTransport : public RefCounted { }); }, [&frame_header]() { - return [status = frame_header.status()]() mutable - -> absl::StatusOr> { - return std::move(status); - }; + return + [status = frame_header.status()]() mutable + -> absl::StatusOr> { + return std::move(status); + }; }); }); } diff --git a/src/core/ext/transport/chaotic_good_legacy/server_transport.cc b/src/core/ext/transport/chaotic_good_legacy/server_transport.cc index 5f363249ad5..7d6be8ce548 100644 --- a/src/core/ext/transport/chaotic_good_legacy/server_transport.cc +++ b/src/core/ext/transport/chaotic_good_legacy/server_transport.cc @@ -176,7 +176,7 @@ auto ChaoticGoodServerTransport::SendCallBody( const uint32_t padding = message_length % aligned_bytes == 0 ? 0 - : aligned_bytes - message_length % aligned_bytes; + : aligned_bytes - (message_length % aligned_bytes); CHECK_EQ((message_length + padding) % aligned_bytes, 0u); frame.message = FragmentMessage(std::move(message), padding, message_length); diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.cc b/src/core/ext/transport/chttp2/transport/bin_decoder.cc index d996de7315e..ef627e60d08 100644 --- a/src/core/ext/transport/chttp2/transport/bin_decoder.cc +++ b/src/core/ext/transport/chttp2/transport/bin_decoder.cc @@ -96,7 +96,7 @@ size_t grpc_chttp2_base64_infer_length_after_decode(const grpc_slice& slice) { << " (without padding), which is invalid.\n"; return 0; } - return tuples * 3 + tail_xtra[tail_case]; + return (tuples * 3) + tail_xtra[tail_case]; } bool grpc_base64_decode_partial(struct grpc_base64_decode_context* ctx) { @@ -215,7 +215,8 @@ grpc_slice grpc_chttp2_base64_decode_with_length(const grpc_slice& input, input_length / 4 * 3 + tail_xtra[input_length % 4])) { LOG(ERROR) << "Base64 decoding failed, output_length " << output_length << " is longer than the max possible output length " - << (input_length / 4 * 3 + tail_xtra[input_length % 4]) << ".\n"; + << ((input_length / 4 * 3) + tail_xtra[input_length % 4]) + << ".\n"; grpc_core::CSliceUnref(output); return grpc_empty_slice(); } diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.cc b/src/core/ext/transport/chttp2/transport/bin_encoder.cc index 8a6b3670ce1..c9727428ebc 100644 --- a/src/core/ext/transport/chttp2/transport/bin_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/bin_encoder.cc @@ -51,7 +51,7 @@ grpc_slice grpc_chttp2_base64_encode(const grpc_slice& input) { size_t input_length = GRPC_SLICE_LENGTH(input); size_t input_triplets = input_length / 3; size_t tail_case = input_length % 3; - size_t output_length = input_triplets * 4 + tail_xtra[tail_case]; + size_t output_length = (input_triplets * 4) + tail_xtra[tail_case]; grpc_slice output = GRPC_SLICE_MALLOC(output_length); const uint8_t* in = GRPC_SLICE_START_PTR(input); char* out = reinterpret_cast GRPC_SLICE_START_PTR(output); @@ -171,9 +171,9 @@ grpc_slice grpc_chttp2_base64_encode_and_huffman_compress( size_t input_length = GRPC_SLICE_LENGTH(input); size_t input_triplets = input_length / 3; size_t tail_case = input_length % 3; - size_t output_syms = input_triplets * 4 + tail_xtra[tail_case]; + size_t output_syms = (input_triplets * 4) + tail_xtra[tail_case]; size_t max_output_bits = 11 * output_syms; - size_t max_output_length = max_output_bits / 8 + (max_output_bits % 8 != 0); + size_t max_output_length = (max_output_bits / 8) + (max_output_bits % 8 != 0); grpc_slice output = GRPC_SLICE_MALLOC(max_output_length); const uint8_t* in = GRPC_SLICE_START_PTR(input); uint8_t* start_out = GRPC_SLICE_START_PTR(output); diff --git a/src/core/ext/transport/chttp2/transport/decode_huff.h b/src/core/ext/transport/chttp2/transport/decode_huff.h index 21f087585c0..555c2da2683 100644 --- a/src/core/ext/transport/chttp2/transport/decode_huff.h +++ b/src/core/ext/transport/chttp2/transport/decode_huff.h @@ -87,7 +87,7 @@ class HuffDecoderCommon { return table1_emit_[i >> 6][emit]; } static inline uint64_t GetOp13(size_t i) { - return table13_0_inner_[(i < 3 ? (i) : ((i - 3) / 12 + 3))]; + return table13_0_inner_[(i < 3 ? (i) : (((i - 3) / 12) + 3))]; } static inline uint64_t GetEmit13(size_t, size_t emit) { return (emit < 1 ? (((void)emit, 92)) : ((emit - 1) ? 208 : 195)); @@ -189,7 +189,7 @@ class HuffDecoderCommon { } static inline uint64_t GetEmit37(size_t, size_t emit) { return emit + 236; } static inline uint64_t GetOp36(size_t i) { - return table36_0_inner_[(i < 3 ? (i / 2 + 0) : ((i - 3) + 1))]; + return table36_0_inner_[(i < 3 ? ((i / 2) + 0) : ((i - 3) + 1))]; } static inline uint64_t GetEmit36(size_t, size_t emit) { return table36_0_emit_[emit]; diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc index f65cba16a0a..59755e4d522 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.cc +++ b/src/core/ext/transport/chttp2/transport/flow_control.cc @@ -182,7 +182,7 @@ TransportFlowControl::TargetInitialWindowSizeBasedOnMemoryPressureAndBdp() // and a value t such that t_min <= t <= t_max, return the value on the line // segment at t. auto lerp = [](double t, double t_min, double t_max, double a, double b) { - return a + (b - a) * (t - t_min) / (t_max - t_min); + return a + ((b - a) * (t - t_min) / (t_max - t_min)); }; // We split memory pressure into three broad regions: // 1. Low memory pressure, the "anything goes" case - we assume no memory diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 82d249f2ce0..4c2227cf5b5 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -403,7 +403,7 @@ absl::optional> HPackParser::String::Unbase64Loop( } std::vector out; - out.reserve(3 * (end - cur) / 4 + 3); + out.reserve((3 * (end - cur) / 4) + 3); // Decode 4 bytes at a time while we can while (end - cur >= 4) { diff --git a/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc b/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc index e8abcaf471d..17e158ae358 100644 --- a/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc +++ b/src/core/lib/event_engine/posix_engine/ev_epoll1_linux.cc @@ -356,7 +356,7 @@ Epoll1Poller::Epoll1Poller(Scheduler* scheduler) CHECK_GE(g_epoll_set_.epfd, 0); GRPC_TRACE_LOG(event_engine_poller, INFO) << "grpc epoll fd: " << g_epoll_set_.epfd; - struct epoll_event ev {}; + struct epoll_event ev{}; ev.events = static_cast(EPOLLIN | EPOLLET); ev.data.ptr = wakeup_fd_.get(); CHECK(epoll_ctl(g_epoll_set_.epfd, EPOLL_CTL_ADD, wakeup_fd_->ReadFd(), diff --git a/src/core/lib/event_engine/posix_engine/timer_heap.cc b/src/core/lib/event_engine/posix_engine/timer_heap.cc index 85fbdb9e01d..458d0b058e1 100644 --- a/src/core/lib/event_engine/posix_engine/timer_heap.cc +++ b/src/core/lib/event_engine/posix_engine/timer_heap.cc @@ -50,7 +50,7 @@ void TimerHeap::AdjustUpwards(size_t i, Timer* t) { // position. void TimerHeap::AdjustDownwards(size_t i, Timer* t) { for (;;) { - size_t left_child = 1 + 2 * i; + size_t left_child = 1 + (2 * i); if (left_child >= timers_.size()) break; size_t right_child = left_child + 1; size_t next_i = diff --git a/src/core/lib/iomgr/closure.h b/src/core/lib/iomgr/closure.h index cf01653e9d8..2404767cafd 100644 --- a/src/core/lib/iomgr/closure.h +++ b/src/core/lib/iomgr/closure.h @@ -212,7 +212,9 @@ inline grpc_closure* grpc_closure_create(grpc_iomgr_cb_func cb, void* cb_arg) { #endif #define GRPC_CLOSURE_LIST_INIT \ - { nullptr, nullptr } + { \ + nullptr, nullptr \ + } inline void grpc_closure_list_init(grpc_closure_list* closure_list) { closure_list->head = closure_list->tail = nullptr; diff --git a/src/core/lib/iomgr/timer_heap.cc b/src/core/lib/iomgr/timer_heap.cc index 617f76ade0f..542de61d888 100644 --- a/src/core/lib/iomgr/timer_heap.cc +++ b/src/core/lib/iomgr/timer_heap.cc @@ -48,7 +48,7 @@ static void adjust_upwards(grpc_timer** first, uint32_t i, grpc_timer* t) { static void adjust_downwards(grpc_timer** first, uint32_t i, uint32_t length, grpc_timer* t) { for (;;) { - uint32_t left_child = 1u + 2u * i; + uint32_t left_child = 1u + (2u * i); if (left_child >= length) break; uint32_t right_child = left_child + 1; uint32_t next_i = right_child < length && first[left_child]->deadline > diff --git a/src/core/lib/promise/map.h b/src/core/lib/promise/map.h index f93a852fcb0..aa9e1ac581b 100644 --- a/src/core/lib/promise/map.h +++ b/src/core/lib/promise/map.h @@ -79,7 +79,7 @@ template GPR_ATTRIBUTE_ALWAYS_INLINE_FUNCTION inline auto CheckDelayed(Promise promise) { using P = promise_detail::PromiseLike; return [delayed = false, promise = P(std::move(promise))]() mutable - -> Poll> { + -> Poll> { auto r = promise(); if (r.pending()) { delayed = true; diff --git a/src/core/lib/promise/match_promise.h b/src/core/lib/promise/match_promise.h index eeb6152a18c..f92457137ed 100644 --- a/src/core/lib/promise/match_promise.h +++ b/src/core/lib/promise/match_promise.h @@ -50,9 +50,8 @@ struct ConstructPromiseVariantVisitor { // the result into a variant type that covers ALL of the possible return types // given the input types listed in Ts... template - auto operator()(T x) - -> absl::variant()))>...> { + auto operator()(T x) -> absl::variant()))>...> { return CallConstructorThenFactory(x); } }; diff --git a/src/core/lib/resource_quota/memory_quota.cc b/src/core/lib/resource_quota/memory_quota.cc index a8e1099cedd..a343477c5a4 100644 --- a/src/core/lib/resource_quota/memory_quota.cc +++ b/src/core/lib/resource_quota/memory_quota.cc @@ -346,7 +346,7 @@ void GrpcMemoryAllocatorImpl::MaybeDonateBack() { size_t ret = 0; if (!IsUnconstrainedMaxQuotaBufferSizeEnabled() && free > kMaxQuotaBufferSize / 2) { - ret = std::max(ret, free - kMaxQuotaBufferSize / 2); + ret = std::max(ret, free - (kMaxQuotaBufferSize / 2)); } ret = std::max(ret, free > 8192 ? free / 2 : free); const size_t new_free = free - ret; @@ -719,8 +719,8 @@ double PressureController::Update(double error) { // (If we want a control value that's higher than the last one we snap // immediately because it's likely that memory pressure is growing unchecked). if (new_control < last_control_) { - new_control = - std::max(new_control, last_control_ - max_reduction_per_tick_ / 1000.0); + new_control = std::max(new_control, + last_control_ - (max_reduction_per_tick_ / 1000.0)); } last_control_ = new_control; return new_control; diff --git a/src/core/lib/surface/filter_stack_call.h b/src/core/lib/surface/filter_stack_call.h index d9a8866d5e4..32178fe7c2c 100644 --- a/src/core/lib/surface/filter_stack_call.h +++ b/src/core/lib/surface/filter_stack_call.h @@ -131,7 +131,7 @@ class FilterStackCall final : public Call { static size_t InitialSizeEstimate() { return sizeof(FilterStackCall) + - sizeof(BatchControl) * kMaxConcurrentBatches; + (sizeof(BatchControl) * kMaxConcurrentBatches); } char* GetPeer() final; diff --git a/src/core/lib/transport/bdp_estimator.cc b/src/core/lib/transport/bdp_estimator.cc index 90d7cf9429c..61b779d62c9 100644 --- a/src/core/lib/transport/bdp_estimator.cc +++ b/src/core/lib/transport/bdp_estimator.cc @@ -43,7 +43,7 @@ Timestamp BdpEstimator::CompletePing() { gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC); gpr_timespec dt_ts = gpr_time_sub(now, ping_start_time_); double dt = static_cast(dt_ts.tv_sec) + - 1e-9 * static_cast(dt_ts.tv_nsec); + (1e-9 * static_cast(dt_ts.tv_nsec)); double bw = dt > 0 ? (static_cast(accumulator_) / dt) : 0; Duration start_inter_ping_delay = inter_ping_delay_; GRPC_TRACE_LOG(bdp_estimator, INFO) diff --git a/src/core/lib/transport/call_filters.h b/src/core/lib/transport/call_filters.h index 27c2a75d60b..aebda8a4d1e 100644 --- a/src/core/lib/transport/call_filters.h +++ b/src/core/lib/transport/call_filters.h @@ -1585,8 +1585,8 @@ class CallFilters { private: template (filters_detail::StackData::*layout), + Input(CallFilters::* input_location), + filters_detail::Layout(filters_detail::StackData::* layout), void (CallState::*on_done)(), typename StackIterator> class MetadataExecutor { public: @@ -1639,9 +1639,9 @@ class CallFilters { filters_detail::OperationExecutor executor_; }; - template ( - filters_detail::StackData::*layout), + filters_detail::StackData::* layout), void (CallState::*on_done)(), typename StackIterator> class MessageExecutor { public: diff --git a/src/core/lib/transport/interception_chain.h b/src/core/lib/transport/interception_chain.h index db54104dafa..98c6dbe52ff 100644 --- a/src/core/lib/transport/interception_chain.h +++ b/src/core/lib/transport/interception_chain.h @@ -106,7 +106,7 @@ class Interceptor : public UnstartedCallDestination { return Map(call_handler.PullClientInitialMetadata(), [call_handler, destination = wrapped_destination_]( ValueOrFailure metadata) mutable - -> ValueOrFailure { + -> ValueOrFailure { if (!metadata.ok()) return Failure{}; return HijackedCall(std::move(metadata.value()), std::move(destination), diff --git a/src/core/lib/transport/timeout_encoding.cc b/src/core/lib/transport/timeout_encoding.cc index 845dbf7a26f..08a5c8d5783 100644 --- a/src/core/lib/transport/timeout_encoding.cc +++ b/src/core/lib/transport/timeout_encoding.cc @@ -258,12 +258,12 @@ absl::optional ParseTimeout(const Slice& text) { Duration timeout; switch (*p) { case 'n': - timeout = - Duration::Milliseconds(x / GPR_NS_PER_MS + (x % GPR_NS_PER_MS != 0)); + timeout = Duration::Milliseconds((x / GPR_NS_PER_MS) + + (x % GPR_NS_PER_MS != 0)); break; case 'u': - timeout = - Duration::Milliseconds(x / GPR_US_PER_MS + (x % GPR_US_PER_MS != 0)); + timeout = Duration::Milliseconds((x / GPR_US_PER_MS) + + (x % GPR_US_PER_MS != 0)); break; case 'm': timeout = Duration::Milliseconds(x); diff --git a/src/core/load_balancing/outlier_detection/outlier_detection.cc b/src/core/load_balancing/outlier_detection/outlier_detection.cc index 448f3da2271..c2a3dab85cb 100644 --- a/src/core/load_balancing/outlier_detection/outlier_detection.cc +++ b/src/core/load_balancing/outlier_detection/outlier_detection.cc @@ -924,7 +924,7 @@ void OutlierDetectionLb::EjectionTimer::OnTimerLocked() { double stdev = std::sqrt(variance); const double success_rate_stdev_factor = static_cast(config.success_rate_ejection->stdev_factor) / 1000; - double ejection_threshold = mean - stdev * success_rate_stdev_factor; + double ejection_threshold = mean - (stdev * success_rate_stdev_factor); GRPC_TRACE_LOG(outlier_detection_lb, INFO) << "[outlier_detection_lb " << parent_.get() << "] stdev=" << stdev << ", ejection_threshold=" << ejection_threshold; diff --git a/src/core/telemetry/histogram_view.cc b/src/core/telemetry/histogram_view.cc index fdfa402d6d2..5357cbebb08 100644 --- a/src/core/telemetry/histogram_view.cc +++ b/src/core/telemetry/histogram_view.cc @@ -54,9 +54,9 @@ double HistogramView::ThresholdForCountBelow(double count_below) const { // should lie lower_bound = bucket_boundaries[lower_idx]; upper_bound = bucket_boundaries[lower_idx + 1]; - return upper_bound - (upper_bound - lower_bound) * - (count_so_far - count_below) / - static_cast(buckets[lower_idx]); + return upper_bound - + ((upper_bound - lower_bound) * (count_so_far - count_below) / + static_cast(buckets[lower_idx])); } } diff --git a/src/core/util/gpr_time.cc b/src/core/util/gpr_time.cc index 9368e51416b..ac19283bb04 100644 --- a/src/core/util/gpr_time.cc +++ b/src/core/util/gpr_time.cc @@ -224,7 +224,7 @@ int gpr_time_similar(gpr_timespec a, gpr_timespec b, gpr_timespec threshold) { int32_t gpr_time_to_millis(gpr_timespec t) { if (t.tv_sec >= 2147483) { if (t.tv_sec == 2147483 && t.tv_nsec < 648 * GPR_NS_PER_MS) { - return 2147483 * GPR_MS_PER_SEC + t.tv_nsec / GPR_NS_PER_MS; + return (2147483 * GPR_MS_PER_SEC) + (t.tv_nsec / GPR_NS_PER_MS); } return 2147483647; } else if (t.tv_sec <= -2147483) { @@ -232,13 +232,13 @@ int32_t gpr_time_to_millis(gpr_timespec t) { // care?) return -2147483647; } else { - return static_cast(t.tv_sec * GPR_MS_PER_SEC + - t.tv_nsec / GPR_NS_PER_MS); + return static_cast((t.tv_sec * GPR_MS_PER_SEC) + + (t.tv_nsec / GPR_NS_PER_MS)); } } double gpr_timespec_to_micros(gpr_timespec t) { - return static_cast(t.tv_sec) * GPR_US_PER_SEC + t.tv_nsec * 1e-3; + return (static_cast(t.tv_sec) * GPR_US_PER_SEC) + (t.tv_nsec * 1e-3); } gpr_timespec gpr_convert_clock_type(gpr_timespec t, gpr_clock_type clock_type) { diff --git a/src/core/util/json/json_object_loader.h b/src/core/util/json/json_object_loader.h index 96bd8655b91..cbf9509fb31 100644 --- a/src/core/util/json/json_object_loader.h +++ b/src/core/util/json/json_object_loader.h @@ -457,7 +457,7 @@ const LoaderInterface* LoaderForType() { struct Element { Element() = default; template - Element(const char* name, bool optional, B A::*p, + Element(const char* name, bool optional, B A::* p, const LoaderInterface* loader, const char* enable_key) : loader(loader), member_offset(static_cast( @@ -564,13 +564,13 @@ class JsonObjectLoader final { template JsonObjectLoader Field( - const char* name, U T::*p, const char* enable_key = nullptr) const { + const char* name, U T::* p, const char* enable_key = nullptr) const { return Field(name, false, p, enable_key); } template JsonObjectLoader OptionalField( - const char* name, U T::*p, const char* enable_key = nullptr) const { + const char* name, U T::* p, const char* enable_key = nullptr) const { return Field(name, true, p, enable_key); } @@ -581,7 +581,7 @@ class JsonObjectLoader final { private: template JsonObjectLoader Field(const char* name, bool optional, - U T::*p, + U T::* p, const char* enable_key) const { return JsonObjectLoader( elements_, Element(name, optional, p, LoaderForType(), enable_key)); diff --git a/src/core/util/string.cc b/src/core/util/string.cc index 036a23afbb2..00cf0b00269 100644 --- a/src/core/util/string.cc +++ b/src/core/util/string.cc @@ -183,7 +183,7 @@ int gpr_ltoa(long value, char* output) { sign = value < 0 ? -1 : 1; while (value) { - output[i++] = static_cast('0' + sign * (value % 10)); + output[i++] = static_cast('0' + (sign * (value % 10))); value /= 10; } if (sign < 0) output[i++] = '-'; @@ -204,7 +204,7 @@ int int64_ttoa(int64_t value, char* output) { sign = value < 0 ? -1 : 1; while (value) { - output[i++] = static_cast('0' + sign * (value % 10)); + output[i++] = static_cast('0' + (sign * (value % 10))); value /= 10; } if (sign < 0) output[i++] = '-'; diff --git a/src/core/util/time.cc b/src/core/util/time.cc index a15242f3b03..2d7c6873c10 100644 --- a/src/core/util/time.cc +++ b/src/core/util/time.cc @@ -120,9 +120,9 @@ gpr_timespec MillisecondsAsTimespec(int64_t millis, gpr_clock_type clock_type) { int64_t TimespanToMillisRoundUp(gpr_timespec ts) { CHECK(ts.clock_type == GPR_TIMESPAN); double x = GPR_MS_PER_SEC * static_cast(ts.tv_sec) + - static_cast(ts.tv_nsec) / GPR_NS_PER_MS + - static_cast(GPR_NS_PER_SEC - 1) / - static_cast(GPR_NS_PER_SEC); + (static_cast(ts.tv_nsec) / GPR_NS_PER_MS) + + (static_cast(GPR_NS_PER_SEC - 1) / + static_cast(GPR_NS_PER_SEC)); if (x <= static_cast(std::numeric_limits::min())) { return std::numeric_limits::min(); } @@ -135,7 +135,7 @@ int64_t TimespanToMillisRoundUp(gpr_timespec ts) { int64_t TimespanToMillisRoundDown(gpr_timespec ts) { CHECK(ts.clock_type == GPR_TIMESPAN); double x = GPR_MS_PER_SEC * static_cast(ts.tv_sec) + - static_cast(ts.tv_nsec) / GPR_NS_PER_MS; + (static_cast(ts.tv_nsec) / GPR_NS_PER_MS); if (x <= static_cast(std::numeric_limits::min())) { return std::numeric_limits::min(); } diff --git a/src/core/util/time.h b/src/core/util/time.h index c51b3cf63ed..5d43409cbf9 100644 --- a/src/core/util/time.h +++ b/src/core/util/time.h @@ -227,11 +227,11 @@ class Duration { } static constexpr Duration MicrosecondsRoundUp(int64_t micros) { - return Duration(micros / GPR_US_PER_MS + (micros % GPR_US_PER_MS != 0)); + return Duration((micros / GPR_US_PER_MS) + (micros % GPR_US_PER_MS != 0)); } static constexpr Duration NanosecondsRoundUp(int64_t nanos) { - return Duration(nanos / GPR_NS_PER_MS + (nanos % GPR_NS_PER_MS != 0)); + return Duration((nanos / GPR_NS_PER_MS) + (nanos % GPR_NS_PER_MS != 0)); } constexpr bool operator==(Duration other) const { diff --git a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc index 6b0adc5b254..9870bf4d0d6 100644 --- a/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc +++ b/src/cpp/server/load_reporter/load_reporter_async_service_impl.cc @@ -223,8 +223,8 @@ void LoadReporterAsyncServiceImpl::ReportLoadHandler::OnReadDone( load_key_); const auto& load_report_interval = initial_request.load_report_interval(); load_report_interval_ms_ = - static_cast(load_report_interval.seconds() * 1000 + - load_report_interval.nanos() / 1000); + static_cast((load_report_interval.seconds() * 1000) + + (load_report_interval.nanos() / 1000)); LOG(INFO) << "[LRS " << service_ << "] Initial request received. Start load reporting (load " "balanced host: " diff --git a/src/ruby/ext/grpc/rb_grpc.h b/src/ruby/ext/grpc/rb_grpc.h index 01b7e0d4c78..d1e27257031 100644 --- a/src/ruby/ext/grpc/rb_grpc.h +++ b/src/ruby/ext/grpc/rb_grpc.h @@ -53,7 +53,7 @@ extern VALUE sym_metadata; /* GRPC_RB_MEMSIZE_UNAVAILABLE is used in rb_data_type_t to indicate that the * number of bytes used by the wrapped struct is not available. */ -#define GRPC_RB_MEMSIZE_UNAVAILABLE (size_t(*)(const void*))(NULL) +#define GRPC_RB_MEMSIZE_UNAVAILABLE (size_t (*)(const void*))(NULL) /* A ruby object alloc func that fails by raising an exception. */ VALUE grpc_rb_cannot_alloc(VALUE cls); diff --git a/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template b/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template index 8d21fb6038d..b475b6313f1 100644 --- a/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template +++ b/templates/tools/dockerfile/grpc_clang_format/Dockerfile.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM silkeh/clang:18-bookworm + FROM silkeh/clang:19-bookworm ADD clang_format_all_the_things.sh / diff --git a/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template b/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template index 3b7a7b036e7..b83bf5241bb 100644 --- a/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template +++ b/templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM silkeh/clang:18-bookworm + FROM silkeh/clang:19-bookworm # Install prerequisites for the clang-tidy script RUN apt-get update && apt-get install -y python3 jq git && apt-get clean diff --git a/templates/tools/dockerfile/test/sanity/Dockerfile.template b/templates/tools/dockerfile/test/sanity/Dockerfile.template index e429c78ce32..b4ef30bb671 100644 --- a/templates/tools/dockerfile/test/sanity/Dockerfile.template +++ b/templates/tools/dockerfile/test/sanity/Dockerfile.template @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. - FROM silkeh/clang:18-bookworm + FROM silkeh/clang:19-bookworm <%include file="../../apt_get_basic.include"/> diff --git a/test/core/channelz/channelz_test.cc b/test/core/channelz/channelz_test.cc index ce58754cb74..b3c54e16dc1 100644 --- a/test/core/channelz/channelz_test.cc +++ b/test/core/channelz/channelz_test.cc @@ -472,9 +472,13 @@ TEST_F(ChannelzRegistryBasedTest, GetTopChannelsNoHitUuid) { TEST_F(ChannelzRegistryBasedTest, GetTopChannelsMoreGaps) { ExecCtx exec_ctx; ChannelFixture channel_with_uuid1; - { ServerFixture channel_with_uuid2; } + { + ServerFixture channel_with_uuid2; + } ChannelFixture channel_with_uuid3; - { ServerFixture server_with_uuid4; } + { + ServerFixture server_with_uuid4; + } ChannelFixture channel_with_uuid5; // Current state of list: [1, NULL, 3, NULL, 5] std::string json_str = ChannelzRegistry::GetTopChannels(2); diff --git a/test/core/event_engine/posix/timer_heap_test.cc b/test/core/event_engine/posix/timer_heap_test.cc index 5d71ee6f52e..23342d39f92 100644 --- a/test/core/event_engine/posix/timer_heap_test.cc +++ b/test/core/event_engine/posix/timer_heap_test.cc @@ -50,7 +50,7 @@ std::vector CreateTestElements(size_t num_elements) { void CheckValid(TimerHeap* pq) { const std::vector& timers = pq->TestOnlyGetTimers(); for (size_t i = 0; i < timers.size(); ++i) { - size_t left_child = 1u + 2u * i; + size_t left_child = 1u + (2u * i); size_t right_child = left_child + 1u; if (left_child < timers.size()) { EXPECT_LE(timers[i]->deadline, timers[left_child]->deadline); diff --git a/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc b/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc index 202ead109fb..0191e710089 100644 --- a/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc +++ b/test/core/ext/filters/event_engine_client_channel_resolver/resolver_fuzzer.cc @@ -64,7 +64,7 @@ constexpr char g_grpc_config_prefix[] = "grpc_config="; absl::Status ErrorToAbslStatus( const event_engine_client_channel_resolver::Error& error) { // clamp error.code() in (0, 16] - return absl::Status(static_cast(error.code() % 16 + 1), + return absl::Status(static_cast((error.code() % 16) + 1), error.message()); } diff --git a/test/core/http/parser_test.cc b/test/core/http/parser_test.cc index a7ff86e5cc6..b8b733081d6 100644 --- a/test/core/http/parser_test.cc +++ b/test/core/http/parser_test.cc @@ -317,8 +317,8 @@ TEST(ParserTest, MainTest) { char* tmp1 = static_cast(gpr_malloc(2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH)); - memset(tmp1, 'a', 2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1); - tmp1[2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH - 1] = 0; + memset(tmp1, 'a', (2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) - 1); + tmp1[(2 * GRPC_HTTP_PARSER_MAX_HEADER_LENGTH) - 1] = 0; std::string tmp2 = absl::StrFormat("HTTP/1.0 200 OK\r\nxyz: %s\r\n\r\n", tmp1); gpr_free(tmp1); diff --git a/test/core/iomgr/endpoint_tests.cc b/test/core/iomgr/endpoint_tests.cc index b20245aad53..165da4d1c4f 100644 --- a/test/core/iomgr/endpoint_tests.cc +++ b/test/core/iomgr/endpoint_tests.cc @@ -80,7 +80,7 @@ static void end_test(grpc_endpoint_test_config config) { config.clean_up(); } static grpc_slice* allocate_blocks(size_t num_bytes, size_t slice_size, size_t* num_blocks, uint8_t* current_data) { - size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1 : 0); + size_t nslices = (num_bytes / slice_size) + (num_bytes % slice_size ? 1 : 0); grpc_slice* slices = static_cast(gpr_malloc(sizeof(grpc_slice) * nslices)); size_t num_bytes_left = num_bytes; diff --git a/test/core/iomgr/tcp_posix_test.cc b/test/core/iomgr/tcp_posix_test.cc index 35a7018075b..2935f0c5ae6 100644 --- a/test/core/iomgr/tcp_posix_test.cc +++ b/test/core/iomgr/tcp_posix_test.cc @@ -316,7 +316,8 @@ struct write_socket_state { static grpc_slice* allocate_blocks(size_t num_bytes, size_t slice_size, size_t* num_blocks, uint8_t* current_data) { - size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1u : 0u); + size_t nslices = + (num_bytes / slice_size) + (num_bytes % slice_size ? 1u : 0u); grpc_slice* slices = static_cast(gpr_malloc(sizeof(grpc_slice) * nslices)); size_t num_bytes_left = num_bytes; diff --git a/test/core/iomgr/timer_heap_test.cc b/test/core/iomgr/timer_heap_test.cc index 4882fb2fda2..da299f04ca3 100644 --- a/test/core/iomgr/timer_heap_test.cc +++ b/test/core/iomgr/timer_heap_test.cc @@ -52,7 +52,7 @@ static int contains(grpc_timer_heap* pq, grpc_timer* el) { static void check_valid(grpc_timer_heap* pq) { size_t i; for (i = 0; i < pq->timer_count; ++i) { - size_t left_child = 1u + 2u * i; + size_t left_child = 1u + (2u * i); size_t right_child = left_child + 1u; if (left_child < pq->timer_count) { ASSERT_LE(pq->timers[i]->deadline, pq->timers[left_child]->deadline); @@ -232,7 +232,7 @@ static void shrink_test(void) { size_t expected_size; // A large random number to allow for multiple shrinkages, at least 512. - const size_t num_elements = static_cast(rand()) % 2000 + 512; + const size_t num_elements = (static_cast(rand()) % 2000) + 512; grpc_timer_heap_init(&pq); diff --git a/test/core/network_benchmarks/low_level_ping_pong.cc b/test/core/network_benchmarks/low_level_ping_pong.cc index 44b990eb5ee..563e16ce93c 100644 --- a/test/core/network_benchmarks/low_level_ping_pong.cc +++ b/test/core/network_benchmarks/low_level_ping_pong.cc @@ -290,7 +290,8 @@ static void print_histogram(grpc_histogram* histogram) { static double now(void) { gpr_timespec tv = gpr_now(GPR_CLOCK_REALTIME); - return 1e9 * static_cast(tv.tv_sec) + static_cast(tv.tv_nsec); + return (1e9 * static_cast(tv.tv_sec)) + + static_cast(tv.tv_nsec); } static void client_thread(thread_args* args) { diff --git a/test/core/promise/inter_activity_pipe_test.cc b/test/core/promise/inter_activity_pipe_test.cc index 6493ff35b2d..8b2446c6e2c 100644 --- a/test/core/promise/inter_activity_pipe_test.cc +++ b/test/core/promise/inter_activity_pipe_test.cc @@ -102,7 +102,9 @@ TEST(InterActivityPipe, CanClose) { })); EXPECT_FALSE(done); // Drop the sender - { auto x = std::move(pipe.sender); } + { + auto x = std::move(pipe.sender); + } EXPECT_TRUE(done); } diff --git a/test/core/promise/sleep_test.cc b/test/core/promise/sleep_test.cc index 842320d4eff..e0fa414912e 100644 --- a/test/core/promise/sleep_test.cc +++ b/test/core/promise/sleep_test.cc @@ -179,7 +179,7 @@ TEST(Sleep, StressTest) { for (size_t i = 0; i < kNumActivities / 2; i++) { notifications[i]->WaitForNotification(); activities[i].reset(); - activities[i + kNumActivities / 2].reset(); + activities[i + (kNumActivities / 2)].reset(); exec_ctx.Flush(); } } diff --git a/test/core/resolver/fake_resolver_test.cc b/test/core/resolver/fake_resolver_test.cc index 2f4b7621b39..d71f0ed7aab 100644 --- a/test/core/resolver/fake_resolver_test.cc +++ b/test/core/resolver/fake_resolver_test.cc @@ -108,7 +108,7 @@ class FakeResolverTest : public ::testing::Test { EndpointAddressesList addresses; for (size_t i = 0; i < num_addresses; ++i) { std::string uri_string = absl::StrFormat( - "ipv4:127.0.0.1:100%" PRIuPTR, test_counter * num_addresses + i); + "ipv4:127.0.0.1:100%" PRIuPTR, (test_counter * num_addresses) + i); absl::StatusOr uri = URI::Parse(uri_string); EXPECT_TRUE(uri.ok()); grpc_resolved_address address; diff --git a/test/core/resource_quota/memory_quota_test.cc b/test/core/resource_quota/memory_quota_test.cc index 31993f03377..3db1585eb81 100644 --- a/test/core/resource_quota/memory_quota_test.cc +++ b/test/core/resource_quota/memory_quota_test.cc @@ -130,7 +130,7 @@ TEST(MemoryQuotaTest, MakeSlice) { for (int i = 1; i < 1000; i++) { ExecCtx exec_ctx; int min = i; - int max = 10 * i - 9; + int max = (10 * i) - 9; slices.push_back(memory_allocator.MakeSlice(MemoryRequest(min, max))); } ExecCtx exec_ctx; diff --git a/test/core/test_util/histogram.cc b/test/core/test_util/histogram.cc index d94e78dc990..458de2b749b 100644 --- a/test/core/test_util/histogram.cc +++ b/test/core/test_util/histogram.cc @@ -185,10 +185,10 @@ static double threshold_for_count_below(grpc_histogram* h, double count_below) { // should lie lower_bound = bucket_start(h, static_cast(lower_idx)); upper_bound = bucket_start(h, static_cast(lower_idx + 1)); - return grpc_core::Clamp(upper_bound - (upper_bound - lower_bound) * - (count_so_far - count_below) / - h->buckets[lower_idx], - h->min_seen, h->max_seen); + return grpc_core::Clamp( + upper_bound - ((upper_bound - lower_bound) * + (count_so_far - count_below) / h->buckets[lower_idx]), + h->min_seen, h->max_seen); } } diff --git a/test/core/test_util/stack_tracer.cc b/test/core/test_util/stack_tracer.cc index 979e5dad534..e61924343ba 100644 --- a/test/core/test_util/stack_tracer.cc +++ b/test/core/test_util/stack_tracer.cc @@ -29,7 +29,7 @@ namespace { -constexpr int kPrintfPointerFieldWidth = 2 + 2 * sizeof(void*); +constexpr int kPrintfPointerFieldWidth = 2 + (2 * sizeof(void*)); void DumpPCAndFrameSizeAndSymbol(void (*writerfn)(const char*, void*), void* writerfn_arg, void* pc, diff --git a/test/core/tsi/alts/crypt/gsec_test_util.cc b/test/core/tsi/alts/crypt/gsec_test_util.cc index a6f7209d1a1..7f317f67140 100644 --- a/test/core/tsi/alts/crypt/gsec_test_util.cc +++ b/test/core/tsi/alts/crypt/gsec_test_util.cc @@ -25,7 +25,7 @@ void gsec_test_random_bytes(uint8_t* bytes, size_t length) { srand(time(nullptr)); size_t ind; for (ind = 0; ind < length; ind++) { - bytes[ind] = static_cast(rand() % 255 + 1); + bytes[ind] = static_cast((rand() % 255) + 1); } } diff --git a/test/core/util/validation_errors_test.cc b/test/core/util/validation_errors_test.cc index 8423736f3bd..40466961339 100644 --- a/test/core/util/validation_errors_test.cc +++ b/test/core/util/validation_errors_test.cc @@ -29,7 +29,9 @@ TEST(ValidationErrors, NoErrors) { EXPECT_EQ(errors.size(), 0); { ValidationErrors::ScopedField field(&errors, "foo"); - { ValidationErrors::ScopedField field(&errors, ".bar"); } + { + ValidationErrors::ScopedField field(&errors, ".bar"); + } } EXPECT_TRUE(errors.ok()); EXPECT_EQ(errors.size(), 0); diff --git a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc index 282d8fa3d35..278737e81ba 100644 --- a/test/cpp/end2end/xds/xds_cluster_end2end_test.cc +++ b/test/cpp/end2end/xds/xds_cluster_end2end_test.cc @@ -1007,7 +1007,7 @@ TEST_P(EdsTest, Drops) { const double kDropRateForLb = kDropPerMillionForLb / 1000000.0; const double kDropRateForThrottle = kDropPerMillionForThrottle / 1000000.0; const double kDropRateForLbAndThrottle = - kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; + kDropRateForLb + ((1 - kDropRateForLb) * kDropRateForThrottle); const double kErrorTolerance = 0.05; const size_t kNumRpcs = ComputeIdealNumRpcs(kDropRateForLbAndThrottle, kErrorTolerance); @@ -1079,7 +1079,7 @@ TEST_P(EdsTest, DropConfigUpdate) { const double kDropRateForLb = kDropPerMillionForLb / 1000000.0; const double kDropRateForThrottle = kDropPerMillionForThrottle / 1000000.0; const double kDropRateForLbAndThrottle = - kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; + kDropRateForLb + ((1 - kDropRateForLb) * kDropRateForThrottle); const size_t kNumRpcsLbOnly = ComputeIdealNumRpcs(kDropRateForLb, kErrorTolerance); const size_t kNumRpcsBoth = @@ -2340,7 +2340,7 @@ TEST_P(ClientLoadReportingTest, DropStats) { const double kDropRateForLb = kDropPerMillionForLb / 1000000.0; const double kDropRateForThrottle = kDropPerMillionForThrottle / 1000000.0; const double kDropRateForLbAndThrottle = - kDropRateForLb + (1 - kDropRateForLb) * kDropRateForThrottle; + kDropRateForLb + ((1 - kDropRateForLb) * kDropRateForThrottle); const size_t kNumRpcs = ComputeIdealNumRpcs(kDropRateForLbAndThrottle, kErrorTolerance); // The ADS response contains two drop categories. diff --git a/test/cpp/microbenchmarks/callback_unary_ping_pong.h b/test/cpp/microbenchmarks/callback_unary_ping_pong.h index 7f139342da8..17b48b1e754 100644 --- a/test/cpp/microbenchmarks/callback_unary_ping_pong.h +++ b/test/cpp/microbenchmarks/callback_unary_ping_pong.h @@ -91,8 +91,8 @@ static void BM_CallbackUnaryPingPong(benchmark::State& state) { cv.wait(l); } fixture.reset(); - state.SetBytesProcessed(request_msgs_size * state.iterations() + - response_msgs_size * state.iterations()); + state.SetBytesProcessed((request_msgs_size * state.iterations()) + + (response_msgs_size * state.iterations())); } } // namespace testing diff --git a/test/cpp/microbenchmarks/fullstack_context_mutators.h b/test/cpp/microbenchmarks/fullstack_context_mutators.h index f239052e80b..243ea0b1464 100644 --- a/test/cpp/microbenchmarks/fullstack_context_mutators.h +++ b/test/cpp/microbenchmarks/fullstack_context_mutators.h @@ -91,7 +91,7 @@ class RandomAsciiMetadata { std::string s; s.reserve(length + 1); for (int i = 0; i < length; i++) { - s += static_cast(rand() % 26 + 'a'); + s += static_cast((rand() % 26) + 'a'); } return s; } diff --git a/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h b/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h index 5ef7a3f22f1..1b49f36da78 100644 --- a/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h +++ b/test/cpp/microbenchmarks/fullstack_unary_ping_pong.h @@ -107,8 +107,8 @@ static void BM_UnaryPingPong(benchmark::State& state) { fixture.reset(); server_env[0]->~ServerEnv(); server_env[1]->~ServerEnv(); - state.SetBytesProcessed(state.range(0) * state.iterations() + - state.range(1) * state.iterations()); + state.SetBytesProcessed((state.range(0) * state.iterations()) + + (state.range(1) * state.iterations())); } } // namespace testing } // namespace grpc diff --git a/test/cpp/qps/driver.cc b/test/cpp/qps/driver.cc index a2dee89e905..706f4f8b879 100644 --- a/test/cpp/qps/driver.cc +++ b/test/cpp/qps/driver.cc @@ -178,8 +178,8 @@ static void postprocess_scenario_result(ScenarioResult* result) { result->mutable_summary()->set_server_cpu_usage(0); } else { auto server_cpu_usage = - 100 - 100 * average(result->server_stats(), ServerIdleCpuTime) / - average(result->server_stats(), ServerTotalCpuTime); + 100 - (100 * average(result->server_stats(), ServerIdleCpuTime) / + average(result->server_stats(), ServerTotalCpuTime)); result->mutable_summary()->set_server_cpu_usage(server_cpu_usage); } diff --git a/test/cpp/qps/qps_json_driver.cc b/test/cpp/qps/qps_json_driver.cc index 1fce38a0575..4f6cffc6fe2 100644 --- a/test/cpp/qps/qps_json_driver.cc +++ b/test/cpp/qps/qps_json_driver.cc @@ -180,7 +180,7 @@ static double BinarySearch( const std::map& per_worker_credential_types, bool* success) { while (low <= high * (1 - absl::GetFlag(FLAGS_error_tolerance))) { - double mid = low + (high - low) / 2; + double mid = low + ((high - low) / 2); double current_cpu_load = GetCpuLoad(scenario, mid, per_worker_credential_types, success); VLOG(2) << absl::StrFormat("Binary Search: current_offered_load %.0f", mid); diff --git a/test/cpp/qps/usage_timer.cc b/test/cpp/qps/usage_timer.cc index a44527700a6..7a25691801c 100644 --- a/test/cpp/qps/usage_timer.cc +++ b/test/cpp/qps/usage_timer.cc @@ -31,7 +31,7 @@ #include static double time_double(struct timeval* tv) { - return tv->tv_sec + 1e-6 * tv->tv_usec; + return tv->tv_sec + (1e-6 * tv->tv_usec); } #endif @@ -39,7 +39,7 @@ UsageTimer::UsageTimer() : start_(Sample()) {} double UsageTimer::Now() { auto ts = gpr_now(GPR_CLOCK_REALTIME); - return ts.tv_sec + 1e-9 * ts.tv_nsec; + return ts.tv_sec + (1e-9 * ts.tv_nsec); } static void get_resource_usage(double* utime, double* stime) { diff --git a/test/cpp/util/cli_credentials.cc b/test/cpp/util/cli_credentials.cc index f3df7eb4da1..e3aba5e5f11 100644 --- a/test/cpp/util/cli_credentials.cc +++ b/test/cpp/util/cli_credentials.cc @@ -63,7 +63,7 @@ namespace { const char ACCESS_TOKEN_PREFIX[] = "access_token="; constexpr int ACCESS_TOKEN_PREFIX_LEN = - sizeof(ACCESS_TOKEN_PREFIX) / sizeof(*ACCESS_TOKEN_PREFIX) - 1; + (sizeof(ACCESS_TOKEN_PREFIX) / sizeof(*ACCESS_TOKEN_PREFIX)) - 1; bool IsAccessToken(const std::string& auth) { return auth.length() > ACCESS_TOKEN_PREFIX_LEN && diff --git a/tools/bazelify_tests/dockerimage_current_versions.bzl b/tools/bazelify_tests/dockerimage_current_versions.bzl index 906b833304a..95770d349bc 100644 --- a/tools/bazelify_tests/dockerimage_current_versions.bzl +++ b/tools/bazelify_tests/dockerimage_current_versions.bzl @@ -112,5 +112,5 @@ DOCKERIMAGE_CURRENT_VERSIONS = { "tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:b3eb1a17b7b091e3c5648a803076b2c40601242ff91c04d55997af6641305f68", "tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:d2e79919b2e2d4cc36a29682ecb5170641df4fb506cfb453978ffdeb8a841bd9", "tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:6e8b4696ba0661f11a31ed0992a94d2efcd889a018f57160f0e2fb62963f3593", - "tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:4fb77e7130e10934e65ec0657e286a8ca5850e9a25441dabe2174b3cb6a56180", + "tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:7fd5e54075e74ff4aa5eceb6f00dd15fd5151b43c30a85fa4bd5d55f3dcf8287", } diff --git a/tools/dockerfile/grpc_clang_format/Dockerfile b/tools/dockerfile/grpc_clang_format/Dockerfile index 70a1bbea16a..42d66520bac 100644 --- a/tools/dockerfile/grpc_clang_format/Dockerfile +++ b/tools/dockerfile/grpc_clang_format/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM silkeh/clang:18-bookworm +FROM silkeh/clang:19-bookworm ADD clang_format_all_the_things.sh / diff --git a/tools/dockerfile/grpc_clang_tidy/Dockerfile b/tools/dockerfile/grpc_clang_tidy/Dockerfile index e6121d0c52a..181ebfc9742 100644 --- a/tools/dockerfile/grpc_clang_tidy/Dockerfile +++ b/tools/dockerfile/grpc_clang_tidy/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM silkeh/clang:18-bookworm +FROM silkeh/clang:19-bookworm # Install prerequisites for the clang-tidy script RUN apt-get update && apt-get install -y python3 jq git && apt-get clean diff --git a/tools/dockerfile/test/sanity.current_version b/tools/dockerfile/test/sanity.current_version index 961e2f353fa..5da3c5baa21 100644 --- a/tools/dockerfile/test/sanity.current_version +++ b/tools/dockerfile/test/sanity.current_version @@ -1 +1 @@ -us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:0006a2ed3aca736f842b3e1bf758cb6ab621922d@sha256:4fb77e7130e10934e65ec0657e286a8ca5850e9a25441dabe2174b3cb6a56180 \ No newline at end of file +us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:7b20e380c8ace88e99a1ec934eed62f706aa5bfa@sha256:7fd5e54075e74ff4aa5eceb6f00dd15fd5151b43c30a85fa4bd5d55f3dcf8287 \ No newline at end of file diff --git a/tools/dockerfile/test/sanity/Dockerfile b/tools/dockerfile/test/sanity/Dockerfile index 841be026ca7..ccdbe544cf0 100644 --- a/tools/dockerfile/test/sanity/Dockerfile +++ b/tools/dockerfile/test/sanity/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -FROM silkeh/clang:18-bookworm +FROM silkeh/clang:19-bookworm #================= # Basic C core dependencies