Skip to content

Commit

Permalink
watchman/Future.h: avoid shadowing warnings
Browse files Browse the repository at this point in the history
Summary:
Fix warnings exposed by gcc-4.9.x's -Wshadow-compatible-local
I plan to enable this for all of fbcode, soon.
See https://fburl.com/bad-shadow for justification.

Rename two inner "result" to "res" and "res2" respectively.

This avoids the following errors:

  watchman/Future.h:311:61: error: declaration of 'watchman::Result<std::basic_fbstring<char>, std::__exception_ptr::exception_ptr>&& result' shadows a parameter [-Werror=shadow-compatible-local]
  watchman/Future.h:308:45: error: shadowed declaration is here [-Werror=shadow-compatible-local]

Reviewed By: wez

Differential Revision: D4674208

fbshipit-source-id: 29c5c93cc2837331f20e66a740942e2641536921
  • Loading branch information
meyering authored and facebook-github-bot committed Mar 9, 2017
1 parent 4a9a00e commit d8aaa52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Future.h
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ class Future {
auto state = std::make_shared<thenState>(std::forward<Func>(func));
auto result = state->promise.getFuture();

state_->setCallback([state](Result<T>&& result) {
state_->setCallback([state](Result<T>&& res) {
try {
auto future = state->func(std::move(result));
future.setCallback([state](Result<InnerRet>&& result) {
state->promise.setResult(std::move(result));
auto future = state->func(std::move(res));
future.setCallback([state](Result<InnerRet>&& res2) {
state->promise.setResult(std::move(res2));
});
} catch (const std::exception& exc) {
state->promise.setException(std::current_exception());
Expand Down

0 comments on commit d8aaa52

Please sign in to comment.