diff --git a/.github/workflows/clang-tidy.yaml b/.github/workflows/clang-tidy.yaml index a08ee66897..f6a216e218 100644 --- a/.github/workflows/clang-tidy.yaml +++ b/.github/workflows/clang-tidy.yaml @@ -17,9 +17,9 @@ jobs: matrix: include: - cmake_options: all-options-abiv1-preview - warning_limit: 53 + warning_limit: 50 - cmake_options: all-options-abiv2-preview - warning_limit: 55 + warning_limit: 52 env: CC: /usr/bin/clang-18 CXX: /usr/bin/clang++-18 diff --git a/CHANGELOG.md b/CHANGELOG.md index 361d73a234..4f34bb69d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,6 +49,9 @@ Increment the: * [BAZEL] Add ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW define to otlp_grpc_log_record_exporter [#3988](https://github.com/open-telemetry/opentelemetry-cpp/pull/3988) +* [CODE HEALTH] Fix clang-tidy narrowing conversions in baggage + [#3989](https://github.com/open-telemetry/opentelemetry-cpp/pull/3989) + Important changes: * Enable WITH_OTLP_RETRY_PREVIEW by default diff --git a/api/include/opentelemetry/baggage/baggage.h b/api/include/opentelemetry/baggage/baggage.h index 6e2354366c..0dbf21281a 100644 --- a/api/include/opentelemetry/baggage/baggage.h +++ b/api/include/opentelemetry/baggage/baggage.h @@ -235,8 +235,8 @@ class OPENTELEMETRY_EXPORT Baggage else { ret.push_back('%'); - ret.push_back(to_hex(c >> 4)); - ret.push_back(to_hex(c & 15)); + ret.push_back(to_hex(static_cast(c >> 4))); + ret.push_back(to_hex(static_cast(c & 15))); } } @@ -267,7 +267,7 @@ class OPENTELEMETRY_EXPORT Baggage err = 1; return ""; } - ret.push_back(from_hex(str[i + 1]) << 4 | from_hex(str[i + 2])); + ret.push_back(static_cast(from_hex(str[i + 1]) << 4 | from_hex(str[i + 2]))); i += 2; } else if (str[i] == '+')