[CI] Using clang-17 for clang tidy & format (#35595)

Clang-17 is now better at formatting. Clang-16 used to do some questionable formatting.

Closes #35595

PiperOrigin-RevId: 600829055
pull/35639/head
Esun Kim 10 months ago committed by Copybara-Service
parent 9c94059036
commit af95eafb34
  1. 7
      .clang-tidy
  2. 4
      src/core/lib/gprpp/time.h
  3. 2
      src/core/lib/iomgr/combiner.cc
  4. 2
      src/core/lib/json/json_writer.cc
  5. 2
      src/core/tsi/fake_transport_security.cc
  6. 2
      src/objective-c/tests/InteropTests/InteropTests.m
  7. 2
      templates/tools/dockerfile/grpc_clang_format/Dockerfile.template
  8. 2
      templates/tools/dockerfile/grpc_clang_tidy/Dockerfile.template
  9. 7
      templates/tools/dockerfile/test/sanity/Dockerfile.template
  10. 2
      test/core/util/osa_distance.cc
  11. 2
      tools/bazelify_tests/dockerimage_current_versions.bzl
  12. 2
      tools/dockerfile/grpc_clang_format/Dockerfile
  13. 2
      tools/dockerfile/grpc_clang_tidy/Dockerfile
  14. 2
      tools/dockerfile/test/sanity.current_version
  15. 7
      tools/dockerfile/test/sanity/Dockerfile

@ -32,6 +32,7 @@
# - bugprone-not-null-terminated-result
# - bugprone-signed-char-misuse
# - bugprone-sizeof-expression
# - bugprone-switch-missing-default-case
# - bugprone-too-small-loop-variable
# - bugprone-unchecked-optional-access
# - clang-diagnostic-deprecated-declarations
@ -50,8 +51,10 @@
# - modernize-use-equals-default
# - modernize-use-equals-delete
# - modernize-use-using
# - performance-avoid-endl
# - performance-no-automatic-move
# - performance-no-int-to-ptr
# - performance-noexcept-swap
# - performance-unnecessary-copy-initialization
# - performance-unnecessary-value-param
# - readability-else-after-return
@ -67,6 +70,7 @@ Checks: '-*,
-bugprone-assignment-in-if-condition,
-bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-empty-catch,
-bugprone-exception-escape,
-bugprone-implicit-widening-of-multiplication-result,
-bugprone-infinite-loop,
@ -75,6 +79,7 @@ Checks: '-*,
-bugprone-reserved-identifier,
-bugprone-signed-char-misuse,
-bugprone-sizeof-expression,
-bugprone-switch-missing-default-case,
-bugprone-too-small-loop-variable,
-bugprone-unchecked-optional-access,
google-*,
@ -82,8 +87,10 @@ Checks: '-*,
-google-runtime-int,
-google-runtime-references,
performance-*,
-performance-avoid-endl,
-performance-no-automatic-move,
-performance-no-int-to-ptr,
-performance-noexcept-swap,
-performance-unnecessary-copy-initialization,
-performance-unnecessary-value-param,
clang-diagnostic-deprecated-declarations,

@ -37,7 +37,7 @@
uint64_t now = grpc_core::Timestamp::FromTimespecRoundDown( \
gpr_now(GPR_CLOCK_MONOTONIC)) \
.milliseconds_after_process_epoch(); \
if (prev == 0 || now - prev > (n)*1000) { \
if (prev == 0 || now - prev > (n) * 1000) { \
prev = now; \
gpr_log(severity, format, __VA_ARGS__); \
} \
@ -50,7 +50,7 @@
gpr_now(GPR_CLOCK_MONOTONIC)) \
.milliseconds_after_process_epoch(); \
uint64_t prev_tsamp = prev.exchange(now); \
if (now - prev_tsamp > (n)*1000) { \
if (now - prev_tsamp > (n) * 1000) { \
gpr_log(severity, format, __VA_ARGS__); \
} \
} while (0)

@ -258,7 +258,7 @@ bool grpc_combiner_continue_exec_ctx() {
// Define a macro to ease readability of the following switch statement.
#define OLD_STATE_WAS(orphaned, elem_count) \
(((orphaned) ? 0 : STATE_UNORPHANED) | \
((elem_count)*STATE_ELEM_COUNT_LOW_BIT))
((elem_count) * STATE_ELEM_COUNT_LOW_BIT))
// Depending on what the previous state was, we need to perform different
// actions.
switch (old_state) {

@ -138,7 +138,7 @@ void JsonWriter::EscapeUtf16(uint16_t utf16) {
OutputChar(hex[(utf16 >> 12) & 0x0f]);
OutputChar(hex[(utf16 >> 8) & 0x0f]);
OutputChar(hex[(utf16 >> 4) & 0x0f]);
OutputChar(hex[(utf16)&0x0f]);
OutputChar(hex[(utf16) & 0x0f]);
}
void JsonWriter::EscapeString(const std::string& string) {

@ -121,7 +121,7 @@ static void store32_little_endian(uint32_t value, unsigned char* buf) {
buf[3] = static_cast<unsigned char>((value >> 24) & 0xFF);
buf[2] = static_cast<unsigned char>((value >> 16) & 0xFF);
buf[1] = static_cast<unsigned char>((value >> 8) & 0xFF);
buf[0] = static_cast<unsigned char>((value)&0xFF);
buf[0] = static_cast<unsigned char>((value) & 0xFF);
}
static uint32_t read_frame_size(const grpc_slice_buffer* sb) {

@ -851,7 +851,7 @@ static dispatch_once_t initGlobalInterceptorFactory;
[call setResponseDispatchQueue:dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL)];
[call start];
}
while (completedCallCount<kNumRpcs && [waitUntil timeIntervalSinceNow]> 0) {
while (completedCallCount < kNumRpcs && [waitUntil timeIntervalSinceNow] > 0) {
[cv waitUntilDate:waitUntil];
}
[cv unlock];

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM silkeh/clang:16-bullseye
FROM silkeh/clang:17-bullseye
ADD clang_format_all_the_things.sh /

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM silkeh/clang:16-bullseye
FROM silkeh/clang:17-bullseye
# Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y python3 jq git && apt-get clean

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM silkeh/clang:16-bullseye
FROM silkeh/clang:17-bullseye
<%include file="../../apt_get_basic.include"/>
@ -52,10 +52,7 @@
RUN python3 -m pip install --upgrade --ignore-installed PyYAML==5.4.1 --user
# Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y jq git
# Install prerequisites for the iwyu script
RUN apt-get update && apt-get install -y jq git cmake zlib1g-dev libtinfo-dev libclang-16-dev && apt-get clean
RUN apt-get update && apt-get install -y jq git && apt-get clean
<%include file="../../bazel.include"/>
<%include file="../../buildifier.include"/>

@ -31,7 +31,7 @@ size_t OsaDistance(absl::string_view s1, absl::string_view s2) {
const auto height = s2.size() + 1;
std::vector<size_t> matrix(width * height,
std::numeric_limits<size_t>::max());
#define MATRIX_CELL(x, y) matrix[(y)*width + (x)]
#define MATRIX_CELL(x, y) matrix[(y) * width + (x)]
MATRIX_CELL(0, 0) = 0;
for (size_t i = 1; i <= s1.size(); ++i) {

@ -111,5 +111,5 @@ DOCKERIMAGE_CURRENT_VERSIONS = {
"tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:d3951aeadf43e3bee6adc5b86d26cdaf0b9d1b5baf790d7b2530d1c197adc9f8",
"tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:7e77cf17e2e8657f4cc23ac9f93630bf13213fff961799e0f16dae17cd45cf6d",
"tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:e4cb502caccf2db733268ce2ddc951fda8a9df2f7f53d6b74523c33d40c83006",
"tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:f1f5ca30491698f793cae75d5989cb53887d159800aef662cf7e6c3df6f86a88",
"tools/dockerfile/test/sanity.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/sanity@sha256:ca65b29302e8e381aabf9deb1952281f4e9963654e19c3d681148b5aa972c8a2",
}

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM silkeh/clang:16-bullseye
FROM silkeh/clang:17-bullseye
ADD clang_format_all_the_things.sh /

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM silkeh/clang:16-bullseye
FROM silkeh/clang:17-bullseye
# Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y python3 jq git && apt-get clean

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:091d8e85bebb7b9f089178ae96435926cdc82fb8@sha256:f1f5ca30491698f793cae75d5989cb53887d159800aef662cf7e6c3df6f86a88
us-docker.pkg.dev/grpc-testing/testing-images-public/sanity:2d20232b40465f3487deef87274f4bfd7122b201@sha256:ca65b29302e8e381aabf9deb1952281f4e9963654e19c3d681148b5aa972c8a2

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM silkeh/clang:16-bullseye
FROM silkeh/clang:17-bullseye
#=================
# Basic C core dependencies
@ -102,10 +102,7 @@ RUN python3 -m pip install simplejson mako virtualenv==16.7.9 lxml six
RUN python3 -m pip install --upgrade --ignore-installed PyYAML==5.4.1 --user
# Install prerequisites for the clang-tidy script
RUN apt-get update && apt-get install -y jq git
# Install prerequisites for the iwyu script
RUN apt-get update && apt-get install -y jq git cmake zlib1g-dev libtinfo-dev libclang-16-dev && apt-get clean
RUN apt-get update && apt-get install -y jq git && apt-get clean
#========================
# Bazel installation

Loading…
Cancel
Save