From c326344380fea5494176369481cff4604a4fe70f Mon Sep 17 00:00:00 2001 From: "dd-apm-ecosystems[bot]" <183529005+dd-apm-ecosystems[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 00:31:13 +0000 Subject: [PATCH 1/3] Enable readability-braces-around-statements in clang-tidy Enables the readability-braces-around-statements clang-tidy check on this repo's shared baseline config, matching what was enabled in DataDog/dd-trace-cpp#390. Uses the `ShortStatementLines: 1` CheckOption (same approach the dd-trace-cpp maintainer landed after review, so a one-line guard clause such as `if (cond) return;` stays exempt) rather than forcing braces onto every brace-less statement unconditionally. Audited httpd-datadog's mod_datadog/src/ files for pre-existing multi-line brace-less if/while/for bodies; none were found, so this should not break the unscoped `make tidy` CI job. --- .clang-tidy | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.clang-tidy b/.clang-tidy index 890d0a8e..0efc6d30 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -18,6 +18,7 @@ Checks: > bugprone-unused-raii, bugprone-virtual-near-miss, misc-unused-using-decls, + readability-braces-around-statements, readability-delete-null-pointer, readability-redundant-control-flow, readability-redundant-string-cstr @@ -33,5 +34,14 @@ Checks: > # performance-noexcept-move-constructor # readability-redundant-member-init # readability-simplify-boolean-expr +# CheckOption rationale: a brace-less if/return whose entire body fits on the +# condition line (e.g. `if (cond) return;`) stays exempt from this check, so we +# don't force braces onto trivial guard clauses. This matches the option the +# dd-trace-cpp maintainer added in DataDog/dd-trace-cpp#390 when first enabling +# this rule there, in response to review feedback that an unconditional +# brace-everywhere approach was too aggressive. +CheckOptions: + - key: readability-braces-around-statements.ShortStatementLines + value: 1 WarningsAsErrors: '*' FormatStyle: file From a03a37f7732d6dc0204ba195a39e5b65853e3228 Mon Sep 17 00:00:00 2001 From: Xavier Lamorlette Date: Mon, 2 Nov 2026 08:51:07 +0100 Subject: [PATCH 2/3] remove useless comment --- .clang-tidy | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 0efc6d30..d9f5817e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -34,12 +34,6 @@ Checks: > # performance-noexcept-move-constructor # readability-redundant-member-init # readability-simplify-boolean-expr -# CheckOption rationale: a brace-less if/return whose entire body fits on the -# condition line (e.g. `if (cond) return;`) stays exempt from this check, so we -# don't force braces onto trivial guard clauses. This matches the option the -# dd-trace-cpp maintainer added in DataDog/dd-trace-cpp#390 when first enabling -# this rule there, in response to review feedback that an unconditional -# brace-everywhere approach was too aggressive. CheckOptions: - key: readability-braces-around-statements.ShortStatementLines value: 1 From b1caa2a2c06182a30a3b6b3e040ef73e251f1c39 Mon Sep 17 00:00:00 2001 From: Xavier Lamorlette Date: Mon, 2 Nov 2026 11:31:03 +0100 Subject: [PATCH 3/3] fix errors newly detected by new Clang Tidy option --- mod_datadog/src/tracing/hooks.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mod_datadog/src/tracing/hooks.cpp b/mod_datadog/src/tracing/hooks.cpp index b6df5f07..c7f539e1 100644 --- a/mod_datadog/src/tracing/hooks.cpp +++ b/mod_datadog/src/tracing/hooks.cpp @@ -50,8 +50,9 @@ static SpanConfig make_span_config( if (r->hostname != nullptr) tags.emplace("http.host", r->hostname); if (r->unparsed_uri != nullptr) tags.emplace("http.url", r->unparsed_uri); - if (r->useragent_ip != nullptr) + if (r->useragent_ip != nullptr) { tags.emplace("http.client_ip", r->useragent_ip); + } if (auto mpm_name = ap_show_mpm(); mpm_name != nullptr) { tags.emplace("httpd.mpm", mpm_name); @@ -123,9 +124,10 @@ int on_fixups(request_rec* r, Tracer& g_tracer, module* datadog_module) { } void* data = ap_get_module_config(r->request_config, datadog_module); - if (data) + if (data) { return DECLINED; ///< `start_span` can not be called twice on the same ///< request + } SpanConfig options = make_span_config(r, dir_conf->tags);