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

fix new GCC warnings #34

Closed
wants to merge 1 commit into from
Closed

fix new GCC warnings #34

wants to merge 1 commit into from

Conversation

neheb
Copy link
Contributor

@neheb neheb commented Jun 21, 2019

error: redundant move in return statement [-Werror=redundant-move]

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@mingtaoy has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Copy link
Contributor

@mingtaoy mingtaoy left a comment

Choose a reason for hiding this comment

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

This causes build failures.

@@ -89,10 +89,10 @@ Param parse<ServerHello>(Buf handshakeMsg, Buf original) {
hrr.extensions = std::move(shlo.extensions);

hrr.originalEncoding = std::move(original);
return std::move(hrr);
return hrr;
Copy link
Contributor

Choose a reason for hiding this comment

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

You cannot elide the move here. NRVO doesn't apply since there are two branches that return different types. We need the std::move() here to explicitly invoke the variant constructor.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fizz/record/RecordLayer.cpp Outdated Show resolved Hide resolved
@facebook-github-bot
Copy link
Contributor

@neheb has updated the pull request. Re-import the pull request

error: redundant move in return statement [-Werror=redundant-move]
@facebook-github-bot
Copy link
Contributor

@neheb has updated the pull request. Re-import the pull request

@neheb
Copy link
Contributor Author

neheb commented Jun 25, 2019

Got rid of all the changes in fizz/record/RecordLayer.cpp . Travis seems happy. Not the case locally. I guess this is good enough.

edit: I should clarify that this only fails when passing -Werror -Wall

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

@mingtaoy has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@knekritz
Copy link
Contributor

knekritz commented Jul 1, 2019

@neheb the issue with implicit constructors that we run into in RecordLayer.cpp is discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87300. Even though it's correct with the new standard, I don't think we want to simply remove the std::move as it will break older (but still recent) compiler versions. I think we could avoid the issue by explicitly calling the variant constructor (return Param(std::move(msg));)

@neheb
Copy link
Contributor Author

neheb commented Jul 1, 2019

Well, fizz does not pass -Werror, so I think it's fine.

@mingtaoy
Copy link
Contributor

mingtaoy commented Jul 1, 2019

Merged. Thanks for your contribution, @neheb!

@facebook-github-bot
Copy link
Contributor

@mingtaoy merged this pull request in fcc0236.

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

Successfully merging this pull request may close these issues.

None yet

4 participants