Commit 448f1272 authored by Michael Lee's avatar Michael Lee Committed by Facebook Github Bot 4

Start compiling a bit of `-Wshadow`

Summary: Sometimes variable shadowing is fine, sometimes it can cause subtle mistakes.

Reviewed By: yfeldblum

Differential Revision: D3140450

fb-gh-sync-id: acf7195ad65614d4f012bef8ce7dccb3a3038456
fbshipit-source-id: acf7195ad65614d4f012bef8ce7dccb3a3038456
parent 177753d9
...@@ -214,11 +214,11 @@ void FormatArg::initSlow() { ...@@ -214,11 +214,11 @@ void FormatArg::initSlow() {
} }
auto readInt = [&] { auto readInt = [&] {
auto const b = p; auto const c = p;
do { do {
++p; ++p;
} while (p != end && *p >= '0' && *p <= '9'); } while (p != end && *p >= '0' && *p <= '9');
return to<int>(StringPiece(b, p)); return to<int>(StringPiece(c, p));
}; };
if (*p == '*') { if (*p == '*') {
...@@ -242,12 +242,12 @@ void FormatArg::initSlow() { ...@@ -242,12 +242,12 @@ void FormatArg::initSlow() {
} }
if (*p == '.') { if (*p == '.') {
auto b = ++p; auto d = ++p;
while (p != end && *p >= '0' && *p <= '9') { while (p != end && *p >= '0' && *p <= '9') {
++p; ++p;
} }
if (p != b) { if (p != d) {
precision = to<int>(StringPiece(b, p)); precision = to<int>(StringPiece(d, p));
if (p != end && *p == '.') { if (p != end && *p == '.') {
trailingDot = true; trailingDot = true;
++p; ++p;
......
...@@ -36,7 +36,7 @@ namespace { ...@@ -36,7 +36,7 @@ namespace {
* A structure to free a struct addrinfo when it goes out of scope. * A structure to free a struct addrinfo when it goes out of scope.
*/ */
struct ScopedAddrInfo { struct ScopedAddrInfo {
explicit ScopedAddrInfo(struct addrinfo* info) : info(info) {} explicit ScopedAddrInfo(struct addrinfo* addrinfo) : info(addrinfo) {}
~ScopedAddrInfo() { ~ScopedAddrInfo() {
freeaddrinfo(info); freeaddrinfo(info);
} }
......
...@@ -115,11 +115,9 @@ size_t qfind_first_byte_of_needles16(const StringPieceLite haystack, ...@@ -115,11 +115,9 @@ size_t qfind_first_byte_of_needles16(const StringPieceLite haystack,
// Now, we can do aligned loads hereafter... // Now, we can do aligned loads hereafter...
size_t i = nextAlignedIndex(haystack.data()); size_t i = nextAlignedIndex(haystack.data());
for (; i < haystack.size(); i+= 16) { for (; i < haystack.size(); i+= 16) {
auto arr1 = _mm_load_si128( arr1 =
reinterpret_cast<const __m128i*>(haystack.data() + i)); _mm_load_si128(reinterpret_cast<const __m128i*>(haystack.data() + i));
auto index = _mm_cmpestri( index = _mm_cmpestri(arr2, needles.size(), arr1, haystack.size() - i, 0);
arr2, needles.size(),
arr1, haystack.size() - i, 0);
if (index < 16) { if (index < 16) {
return i + index; return i + index;
} }
...@@ -211,7 +209,7 @@ size_t qfind_first_byte_of_sse42(const StringPieceLite haystack, ...@@ -211,7 +209,7 @@ size_t qfind_first_byte_of_sse42(const StringPieceLite haystack,
size_t i = nextAlignedIndex(haystack.data()); size_t i = nextAlignedIndex(haystack.data());
for (; i < haystack.size(); i += 16) { for (; i < haystack.size(); i += 16) {
auto ret = scanHaystackBlock<true>(haystack, needles, i); ret = scanHaystackBlock<true>(haystack, needles, i);
if (ret != std::string::npos) { if (ret != std::string::npos) {
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment