Skip to content

[CPPRuntime] Fix C++ Runtime Clang compilation errors#328

Open
rfsaliev wants to merge 8 commits intomainfrom
rfsaliev/cpp-runtime-namespace
Open

[CPPRuntime] Fix C++ Runtime Clang compilation errors#328
rfsaliev wants to merge 8 commits intomainfrom
rfsaliev/cpp-runtime-namespace

Conversation

@rfsaliev
Copy link
Copy Markdown
Member

@rfsaliev rfsaliev commented May 8, 2026

This pull request introduces C++ API versioned namespaces using a macro-based approach, improving maintainability and future-proofing the API. It also adds support for building and testing with both GCC and Clang compilers in CI, and includes several related build and code quality improvements.

Note: Changes in PR are based on #324 made by @mnorris11

API Versioning and Namespace Refactoring:

  • Introduced the SVS_DECLARE_NAMESPACE_VERSION macro for versioned inline namespaces in the runtime API, replacing manual namespace v0 { ... } blocks in all public headers. This change standardizes versioning and makes it easier to add new API versions in the future. (bindings/cpp/include/svs/runtime/version.h, bindings/cpp/include/svs/runtime/api_defs.h, bindings/cpp/include/svs/runtime/dynamic_ivf_index.h, bindings/cpp/include/svs/runtime/dynamic_vamana_index.h, bindings/cpp/include/svs/runtime/flat_index.h, bindings/cpp/include/svs/runtime/ivf_index.h, bindings/cpp/include/svs/runtime/training.h, bindings/cpp/include/svs/runtime/vamana_index.h) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]
  • Updated the VersionInfo structure and related macros to use the new namespace versioning scheme. (bindings/cpp/include/svs/runtime/version.h) [1] [2]

Compiler and Build System Improvements:

  • Added support for building and testing the C++ runtime bindings with both GCC and Clang in CI, including new matrix entries and environment variable handling. (.github/workflows/build-cpp-runtime-bindings.yml, .github/scripts/build-cpp-runtime-bindings.sh, docker/x86_64/manylinux228/Dockerfile) [1] [2] [3] [4]
  • Improved CMake build scripts to add a Clang-specific warning flag for inline namespace issues. (bindings/cpp/CMakeLists.txt)

Code Quality and Maintenance:

  • Added missing override and virtual destructors to implementation classes for better memory safety and clarity. (bindings/cpp/src/dynamic_vamana_index.cpp, bindings/cpp/src/dynamic_vamana_index_impl.h, bindings/cpp/src/vamana_index_impl.h) [1] [2] [3]

Formatting and Linting:

  • Updated .clang-format to recognize the new SVS_DECLARE_NAMESPACE_VERSION macro as a namespace macro. (.clang-format)

@rfsaliev rfsaliev force-pushed the rfsaliev/cpp-runtime-namespace branch from 2548516 to d3ef2c8 Compare May 8, 2026 12:09
@rfsaliev rfsaliev changed the title [CPPRuntime] Fix Clang compilation error for -Werror,-Winline-namespace-reopened-noninline [CPPRuntime] Fix C++ Runtime Clang compilation errors May 8, 2026
@rfsaliev rfsaliev requested a review from Copilot May 8, 2026 13:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the C++ runtime bindings to compile cleanly under Clang by standardizing API versioned namespaces via macros, and extends CI + build tooling to exercise both GCC and Clang builds.

Changes:

  • Introduces SVS_DECLARE_NAMESPACE_VERSION to define versioned inline namespaces across runtime public headers.
  • Extends CI/build scripts and the manylinux Docker image to support selecting GCC vs Clang.
  • Improves runtime implementation correctness by adding override and virtual destructors where polymorphic deletion can occur.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
docker/x86_64/manylinux228/Dockerfile Installs Clang in the manylinux build image used by CI.
bindings/cpp/src/vamana_index_impl.h Adds a virtual destructor to a base implementation class used via inheritance.
bindings/cpp/src/dynamic_vamana_index.cpp Adds missing override on an interface implementation method.
bindings/cpp/src/dynamic_vamana_index_impl.h Adds a virtual destructor to a base implementation class used via inheritance.
bindings/cpp/include/svs/runtime/version.h Adds macro-based namespace versioning helpers and adjusts VersionInfo to live in the versioned namespace.
bindings/cpp/include/svs/runtime/vamana_index.h Switches from namespace v0 to SVS_DECLARE_NAMESPACE_VERSION(0).
bindings/cpp/include/svs/runtime/training.h Switches from namespace v0 to SVS_DECLARE_NAMESPACE_VERSION(0).
bindings/cpp/include/svs/runtime/ivf_index.h Switches from namespace v0 to SVS_DECLARE_NAMESPACE_VERSION(0).
bindings/cpp/include/svs/runtime/flat_index.h Switches from namespace v0 to SVS_DECLARE_NAMESPACE_VERSION(0).
bindings/cpp/include/svs/runtime/dynamic_vamana_index.h Switches to SVS_DECLARE_NAMESPACE_VERSION(0) and removes redundant redeclarations already present in VamanaIndex.
bindings/cpp/include/svs/runtime/dynamic_ivf_index.h Switches from namespace v0 to SVS_DECLARE_NAMESPACE_VERSION(0).
bindings/cpp/include/svs/runtime/api_defs.h Switches from namespace v0 to SVS_DECLARE_NAMESPACE_VERSION(0) for common runtime types.
bindings/cpp/CMakeLists.txt Adds a Clang-only warning intended to catch inline-namespace misuse.
.github/workflows/build-cpp-runtime-bindings.yml Adds compiler selection (GCC/Clang) to the workflow matrix and passes CC/CXX into the container.
.github/scripts/build-cpp-runtime-bindings.sh Uses CC/CXX from the environment (with sensible defaults) when configuring CMake.
.clang-format Treats SVS_DECLARE_NAMESPACE_VERSION as a namespace macro for formatting.

Comment thread bindings/cpp/include/svs/runtime/version.h Outdated
Comment thread bindings/cpp/include/svs/runtime/version.h Outdated
Comment thread bindings/cpp/CMakeLists.txt Outdated
@rfsaliev rfsaliev force-pushed the rfsaliev/cpp-runtime-namespace branch from 5683b73 to 322d1ca Compare May 8, 2026 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants