Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
fblualib/atomicvector/AtomicVector.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
(and/or the stricter -Wshadow-local) options.  Note that these
are both less onerous than -Wshadow.
I plan to enable one of them for all of fbcode, soon.

Rename inner (lambda parameter) "sz" to "siz".
Also rename inner (lambda parameter) "fd" to "readFd".

This avoids the following errors:

  fblualib/atomicvector/AtomicVector.h:347:71: error: declaration of 'sz' shadows a lambda capture [-Werror=shadow-compatible-local]
  fblualib/atomicvector/AtomicVector.h:346:60: error: shadowed declaration is here [-Werror=shadow-compatible-local]
  fblualib/atomicvector/AtomicVector.h:347:72: error: declaration of 'fd' shadows a lambda capture [-Werror=shadow-compatible-local]
  fblualib/atomicvector/AtomicVector.h:346:60: error: shadowed declaration is here [-Werror=shadow-compatible-local]

Reviewed By: andrewjcg, Gownta

Differential Revision: D4442692

fbshipit-source-id: a88e8b410667610392f6abd379cae37916b7c652
  • Loading branch information
meyering authored and facebook-github-bot committed Jan 23, 2017
1 parent b112a1e commit 02f049a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fblualib/atomicvector/AtomicVector.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ class AtomicVector {
for (int tid = 0; tid < nThreads; tid++) {
deserThreads.emplace_back([tid, sz, fd, nThreads, this,
&directory, &finalFilePtr] {
auto safe_pread = [&](int fd, void* dest, size_t sz, off_t off) {
auto retval = pread(fd, dest, sz, off);
if (retval != sz) {
auto safe_pread = [&](int readFd, void* dest, size_t siz, off_t off) {
auto retval = pread(readFd, dest, siz, off);
if (retval != siz) {
auto msg = folly::format("pread failed: {}", strerror(errno));
throw std::runtime_error(msg.str());
}
Expand Down

0 comments on commit 02f049a

Please sign in to comment.