Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

THRIFT-5816: Fix UUID for boost 1.86.0 (change in {{data}} member usage) #3035

Conversation

CJCombrink
Copy link
Contributor

Tries to fix compiler issues with latest boost (1.86)

  • Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
    THRIFT-5816
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

- Not sure why I am seeing this only now
- Appears to break in older compilers
- Accessing the data member directly is discouraged
- Iterate through the uuid type instead
@CJCombrink CJCombrink marked this pull request as ready for review September 4, 2024 18:53
@CJCombrink
Copy link
Contributor Author

@Jens-G
I have tested with Boost 1.86 and the following changes does fix the compilation and the unit tests still pass as expected

@Jens-G Jens-G added the c++ label Sep 4, 2024
@Jens-G Jens-G closed this in ed5c5a4 Sep 4, 2024
Jens-G pushed a commit that referenced this pull request Sep 4, 2024
@@ -112,8 +112,8 @@ class TestHandler : public ThriftTestIf {
out = thing;
}

std::string testUuid(const std::string thing) override {
cout << "[C -> C++] testUuid(\"" << std::hex << thing << "\")" << '\n';
apache::thrift::TUuid testUuid(const apache::thrift::TUuid thing) override {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use const ref on the parameter and return value instead, it avoids copies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately thirft generates the interface with a copy. Perhaps it is something I missed when I added the new type because I see the other functions uses const ref on some arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Jens-G Should I create a ticket for this and fix asap?
It would change how the method is generated if I change it to be a reference:
It appears to change to

virtual void testUuid(apache::thrift::TUuid& _return, const apache::thrift::TUuid& thing) = 0;

but I can't work on this more at this moment, probably only tonight again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jeking3 I made a new PR related to this, would you be so kind to look at it please:
#3038

@@ -107,8 +107,8 @@ class TestHandler : public ThriftTestIf {
out = thing;
}

std::string testUuid(const std::string thing) override {
cout << "[C -> C++] testUuid(\"" << std::hex << thing << "\")" << '\n';
apache::thrift::TUuid testUuid(const apache::thrift::TUuid thing) override {
Copy link
Contributor

Choose a reason for hiding this comment

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

If you use const ref on the parameter and return value instead, it avoids copies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants