Skip to content

Fix compilation with newer protobuf versions#166

Open
tippfehlr wants to merge 1 commit intoUltimaker:mainfrom
tippfehlr:new-protobuf
Open

Fix compilation with newer protobuf versions#166
tippfehlr wants to merge 1 commit intoUltimaker:mainfrom
tippfehlr:new-protobuf

Conversation

@tippfehlr
Copy link

This PR updates the function signatures of hash() and AddError() to use string_view and renames AddError to RecordError. In combination with #160 this builds successfully with up-to-date dependencies for me.

Copilot AI review requested due to automatic review settings February 13, 2026 00:31
@github-actions github-actions bot added the PR: Community Contribution 👑 Community Contribution PR's label Feb 13, 2026
Copy link

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 aims to restore build compatibility with newer Protobuf compiler/importer APIs by updating the local hashing helper to use std::string_view and updating the custom Protobuf MultiFileErrorCollector override to the newer RecordError/string_view-based signature.

Changes:

  • Updated hash() to accept std::string_view and adjusted internal usage accordingly.
  • Renamed/updated the Protobuf error-collector override from AddError(...) to RecordError(...) using absl::string_view.
Comments suppressed due to low confidence (1)

src/MessageTypeStore.cpp:12

  • absl::string_view is used in the RecordError signature, but this file doesn’t include the Abseil header that defines it. Relying on transitive includes from protobuf headers is brittle; please include the appropriate Abseil header explicitly (e.g., the one that defines absl::string_view) so this TU compiles regardless of protobuf’s internal include structure.
#include <string_view>
#include <unordered_map>

#include <google/protobuf/compiler/importer.h>
#include <google/protobuf/dynamic_message.h>

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +43 to 44
void RecordError(absl::string_view filename, int line, int column, absl::string_view message) override
{
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

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

The error collector override was renamed to RecordError(absl::string_view, ...), which likely won’t compile with the currently pinned protobuf version in this repo (protobuf/3.21.12 in conanfile.py). To keep builds working, either bump the protobuf requirement to a version that provides RecordError (and absl::string_view signatures) or add a compatibility shim/#if GOOGLE_PROTOBUF_VERSION ... to implement the correct override for both old (AddError(const std::string&, ...)) and new APIs.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: Community Contribution 👑 Community Contribution PR's

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants