Commit 523ca7d7 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Enable -Wimplicit-fallthrough

Summary: Because just having a linter enforce it isn't good enough to catch everything.

Reviewed By: yfeldblum

Differential Revision: D5101828

fbshipit-source-id: a1bc482b37139a1eddeb93bc298596af950aa87d
parent 887367ca
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#else // !_LIBSTDCXX_FBSTRING #else // !_LIBSTDCXX_FBSTRING
#include <folly/CppAttributes.h>
#include <folly/Portability.h> #include <folly/Portability.h>
// libc++ doesn't provide this header, nor does msvc // libc++ doesn't provide this header, nor does msvc
...@@ -493,7 +494,9 @@ public: ...@@ -493,7 +494,9 @@ public:
if (RefCounted::refs(ml_.data_) > 1) { if (RefCounted::refs(ml_.data_) > 1) {
return ml_.size_; return ml_.size_;
} }
default: {} break;
default:
break;
} }
return ml_.capacity(); return ml_.capacity();
} }
...@@ -747,10 +750,13 @@ inline void fbstring_core<Char>::initSmall( ...@@ -747,10 +750,13 @@ inline void fbstring_core<Char>::initSmall(
switch ((byteSize + wordWidth - 1) / wordWidth) { // Number of words. switch ((byteSize + wordWidth - 1) / wordWidth) { // Number of words.
case 3: case 3:
ml_.capacity_ = reinterpret_cast<const size_t*>(data)[2]; ml_.capacity_ = reinterpret_cast<const size_t*>(data)[2];
FOLLY_FALLTHROUGH;
case 2: case 2:
ml_.size_ = reinterpret_cast<const size_t*>(data)[1]; ml_.size_ = reinterpret_cast<const size_t*>(data)[1];
FOLLY_FALLTHROUGH;
case 1: case 1:
ml_.data_ = *reinterpret_cast<Char**>(const_cast<Char*>(data)); ml_.data_ = *reinterpret_cast<Char**>(const_cast<Char*>(data));
FOLLY_FALLTHROUGH;
case 0: case 0:
break; break;
} }
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include <stdexcept> #include <stdexcept>
#include <iterator> #include <iterator>
#include <folly/CppAttributes.h>
#ifndef FOLLY_STRING_H_ #ifndef FOLLY_STRING_H_
#error This file may only be included from String.h #error This file may only be included from String.h
#endif #endif
...@@ -228,6 +230,7 @@ void uriUnescape(StringPiece str, String& out, UriEscapeMode mode) { ...@@ -228,6 +230,7 @@ void uriUnescape(StringPiece str, String& out, UriEscapeMode mode) {
break; break;
} }
// else fallthrough // else fallthrough
FOLLY_FALLTHROUGH;
default: default:
++p; ++p;
break; break;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <folly/Benchmark.h> #include <folly/Benchmark.h>
#include <folly/CppAttributes.h>
#include <folly/Foreach.h> #include <folly/Foreach.h>
#include <array> #include <array>
...@@ -277,10 +278,12 @@ static int64_t handwrittenAtoi(const char* start, const char* end) { ...@@ -277,10 +278,12 @@ static int64_t handwrittenAtoi(const char* start, const char* end) {
switch (*start) { switch (*start) {
case '-': case '-':
positive = false; positive = false;
FOLLY_FALLTHROUGH;
case '+': case '+':
++start; ++start;
FOLLY_FALLTHROUGH;
default: default:
; break;
} }
while (start < end && *start >= '0' && *start <= '9') { while (start < end && *start >= '0' && *start <= '9') {
......
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