Skip to content

Commit

Permalink
fix -Wshadow issue
Browse files Browse the repository at this point in the history
Summary:
-Wshadow triggered in LLVM-17:
```
fbcode/folly/futures/ThreadWheelTimekeeper.cpp:61:42: error: declaration shadows a structured binding [-Werror,-Wshadow]                                                                      
   61 |   eventBase_.runInEventBaseThread([this, cob = std::move(cob), dur] {                                                                                                                 
      |                                          ^                                                                                                                                            
fbcode/folly/futures/ThreadWheelTimekeeper.cpp:47:9: note: previous declaration is here        
   47 |   auto [cob, sf] = WTCallback<HHWheelTimer>::create(&eventBase_);                                                                                                                     
      |         ^
```

This seems to only be triggered in llvm-17, llvm-15 doesn't pick it up:
```
$ buck2 build -c cxx.extra_cxxflags=-Wshadow folly/futures:core
...                                                                                                                                              
BUILD SUCCEEDE
```

Differential Revision: D54112254
  • Loading branch information
palmje authored and facebook-github-bot committed Feb 23, 2024
1 parent e6e5b60 commit 88da2bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions third-party/folly/src/folly/futures/ThreadWheelTimekeeper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ SemiFuture<Unit> ThreadWheelTimekeeper::after(HighResDuration dur) {
// canceling timeout is executed in EventBase thread, the actual timeout
// callback has either been executed, or will never be executed. So we are
// fine here.
eventBase_.runInEventBaseThread([this, cob = std::move(cob), dur] {
wheelTimer_->scheduleTimeout(cob.get(), folly::chrono::ceil<Duration>(dur));
eventBase_.runInEventBaseThread([this, cob2 = std::move(cob), dur] {
wheelTimer_->scheduleTimeout(
cob2.get(), folly::chrono::ceil<Duration>(dur));
});
return std::move(sf);
}
Expand Down

0 comments on commit 88da2bb

Please sign in to comment.