Skip to content

Commit e649c7f

Browse files
authored
[CODE HEALTH] Move func_grpc_main classes into anonymous namespace (#4129)
Wraps the 3 file-scope class and struct declarations in functional/otlp/func_grpc_main.cc within an anonymous namespace to give them internal linkage and clear the misc-use-internal-linkage warnings clang-tidy reports on this file. The wrap covers TestResult (line 63), TestLogHandler (line 128), and test_case (line 316). It deliberately ends BEFORE the static int test_*() forward declarations at line 322+. This boundary follows the same pattern as #4128 (func_http_main): the test_*() declarations are matched by definitions in the lower half of the file (after main()). Wrapping the declarations alone would create (anonymous namespace)::test_* symbols that fail to link against the file-scope static test_*() definitions. Local verification: build of func_otlp_grpc target with WITH_OTLP_HTTP=ON + WITH_OTLP_GRPC=ON succeeded 122/122 ninja steps; --help smoke test prints usage as expected. main() and all test_*() infrastructure (declarations, the all_tests[] table, list_test_cases, run_test_case, and definitions) remain at file scope with their existing static linkage. Ratchet: * abiv1-preview warning_limit lowered from 349 to 346 * abiv2-preview warning_limit lowered from 353 to 350 Part of #2053 Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com>
1 parent 5791b30 commit e649c7f

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/clang-tidy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
include:
1919
- cmake_options: all-options-abiv1-preview
20-
warning_limit: 349
20+
warning_limit: 346
2121
- cmake_options: all-options-abiv2-preview
22-
warning_limit: 353
22+
warning_limit: 350
2323
env:
2424
CC: /usr/bin/clang-22
2525
CXX: /usr/bin/clang++-22

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ Increment the:
5151
* [CODE HEALTH] Move func_http_main classes into anonymous namespace
5252
[#4128](https://github.com/open-telemetry/opentelemetry-cpp/pull/4128)
5353

54+
* [CODE HEALTH] Move func_grpc_main classes into anonymous namespace
55+
[#4129](https://github.com/open-telemetry/opentelemetry-cpp/pull/4129)
56+
5457
## [1.27.0] 2026-05-13
5558

5659
* [RELEASE] Bump main branch to 1.27.0-dev

functional/otlp/func_grpc_main.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ static std::string opt_cert_dir;
5656
static std::string opt_test_name;
5757
static TestMode opt_mode = TestMode::kNone;
5858

59+
namespace
60+
{
61+
5962
/*
6063
Log parsing
6164
*/
@@ -319,6 +322,8 @@ struct test_case
319322
test_func_t m_func;
320323
};
321324

325+
} // namespace
326+
322327
static int test_basic();
323328

324329
static int test_cert_not_found();

0 commit comments

Comments
 (0)