Commit 63e03761 authored by Nico Weber's avatar Nico Weber

Make //net:net build with -Wimplicit-fallthrough.

Looks like all fallthroughs in net were intentional.
No intended behavior change.

Bug: 741046,177475
Change-Id: I004ce3a7b2eb487a34972ced44e1b564468c7d70
Reviewed-on: https://chromium-review.googlesource.com/887303
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531994}
parent aa113225
......@@ -84,7 +84,7 @@ Error FileErrorToNetError(base::File::Error file_error) {
return ERR_ACCESS_DENIED;
case base::File::FILE_ERROR_MAX:
NOTREACHED();
// fallthrough
FALLTHROUGH;
case base::File::FILE_ERROR_NOT_A_DIRECTORY:
case base::File::FILE_ERROR_NOT_A_FILE:
case base::File::FILE_ERROR_NOT_EMPTY:
......
......@@ -232,7 +232,7 @@ void NetworkThrottleManagerImpl::OnThrottleDestroyed(ThrottleImpl* throttle) {
DCHECK(throttle->queue_pointer() != outstanding_throttles_.end());
DCHECK_EQ(throttle, *(throttle->queue_pointer()));
outstanding_throttles_.erase(throttle->queue_pointer());
// Fall through
FALLTHROUGH;
case ThrottleImpl::State::AGED:
DCHECK(!throttle->start_time().is_null());
lifetime_median_estimate_.AddSample(
......
......@@ -38,7 +38,7 @@ CertStatus MapNetErrorToCertStatus(int error) {
// We should not use ERR_CERT_CONTAINS_ERRORS in new code.
case ERR_CERT_CONTAINS_ERRORS:
NOTREACHED();
// Falls through.
FALLTHROUGH;
case ERR_CERT_INVALID:
return CERT_STATUS_INVALID;
case ERR_CERT_WEAK_SIGNATURE_ALGORITHM:
......
......@@ -87,21 +87,22 @@
// UMA_HISTOGRAM_COUNTS_1M("DiskCache.2.MyName", 20); // "2" is the CacheType.
// UMA_HISTOGRAM_COUNTS_1M("DiskCache.2.MyExperiment_530", 55);
//
#define CACHE_UMA(type, name, experiment, sample) {\
const std::string my_name =\
CACHE_UMA_BACKEND_IMPL_OBJ->HistogramName(name, experiment);\
switch (CACHE_UMA_BACKEND_IMPL_OBJ->cache_type()) {\
default:\
NOTREACHED();\
/* Fall-through. */\
case net::DISK_CACHE:\
case net::MEDIA_CACHE:\
case net::APP_CACHE:\
case net::SHADER_CACHE:\
case net::PNACL_CACHE:\
CACHE_HISTOGRAM_##type(my_name.data(), sample);\
break;\
}\
#define CACHE_UMA(type, name, experiment, sample) \
{ \
const std::string my_name = \
CACHE_UMA_BACKEND_IMPL_OBJ->HistogramName(name, experiment); \
switch (CACHE_UMA_BACKEND_IMPL_OBJ->cache_type()) { \
default: \
NOTREACHED(); \
FALLTHROUGH; \
case net::DISK_CACHE: \
case net::MEDIA_CACHE: \
case net::APP_CACHE: \
case net::SHADER_CACHE: \
case net::PNACL_CACHE: \
CACHE_HISTOGRAM_##type(my_name.data(), sample); \
break; \
} \
}
#endif // NET_DISK_CACHE_BLOCKFILE_HISTOGRAM_MACROS_H_
......@@ -307,7 +307,7 @@ class DnsConfigServicePosix::ConfigReader : public SerialWorker {
case CONFIG_PARSE_POSIX_MISSING_OPTIONS:
case CONFIG_PARSE_POSIX_UNHANDLED_OPTIONS:
DCHECK(dns_config_.unhandled_options);
// Fall through.
FALLTHROUGH;
case CONFIG_PARSE_POSIX_OK:
success_ = true;
break;
......
......@@ -59,6 +59,7 @@ class HostsParser {
}
// If comma_mode_ is COMMA_IS_TOKEN, fall through:
FALLTHROUGH;
default: {
size_t token_start = pos_;
......
......@@ -100,6 +100,7 @@ GZipHeader::Status GZipHeader::ReadMore(const char* inbuf, int inbuf_len,
// We intentionally fall through, because if we have a
// zero-length FEXTRA, we want to check to notice that we're
// done reading the FEXTRA before we exit this loop...
FALLTHROUGH;
case IN_FEXTRA: {
// Grab the rest of the bytes in the extra field, or as many
......
......@@ -69,7 +69,7 @@ DecodeStatus AltSvcPayloadDecoder::ResumeDecodingPayload(
switch (payload_state_) {
case PayloadState::kStartDecodingStruct:
status = state->StartDecodingStructureInPayload(&altsvc_fields_, db);
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kMaybeDecodedStruct:
if (status == DecodeStatus::kDecodeDone &&
......@@ -91,7 +91,7 @@ DecodeStatus AltSvcPayloadDecoder::ResumeDecodingPayload(
DCHECK_GT(altsvc_fields_.origin_length, state->remaining_payload());
return state->ReportFrameSizeError();
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kDecodingStrings:
return DecodeStrings(state, db);
......
......@@ -95,7 +95,7 @@ DecodeStatus DataPayloadDecoder::ResumeDecodingPayload(FrameDecoderState* state,
if (status != DecodeStatus::kDecodeDone) {
return status;
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kReadPayload:
avail = state->AvailablePayload(db);
......@@ -108,7 +108,7 @@ DecodeStatus DataPayloadDecoder::ResumeDecodingPayload(FrameDecoderState* state,
payload_state_ = PayloadState::kReadPayload;
return DecodeStatus::kDecodeInProgress;
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kSkipPadding:
// SkipPadding handles the OnPadding callback.
......
......@@ -72,7 +72,7 @@ DecodeStatus GoAwayPayloadDecoder::ResumeDecodingPayload(
switch (payload_state_) {
case PayloadState::kStartDecodingFixedFields:
status = state->StartDecodingStructureInPayload(&goaway_fields_, db);
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kHandleFixedFieldsStatus:
if (status == DecodeStatus::kDecodeDone) {
......@@ -90,7 +90,7 @@ DecodeStatus GoAwayPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kResumeDecodingFixedFields;
return status;
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kReadOpaqueData:
// The opaque data is all the remains to be decoded, so anything left
......
......@@ -125,7 +125,7 @@ DecodeStatus HeadersPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPayload;
continue;
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kStartDecodingPriorityFields:
status = state->StartDecodingStructureInPayload(&priority_fields_, db);
......@@ -134,7 +134,7 @@ DecodeStatus HeadersPayloadDecoder::ResumeDecodingPayload(
return status;
}
state->listener()->OnHeadersPriority(priority_fields_);
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kReadPayload:
avail = state->AvailablePayload(db);
......@@ -147,7 +147,7 @@ DecodeStatus HeadersPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPayload;
return DecodeStatus::kDecodeInProgress;
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kSkipPadding:
// SkipPadding handles the OnPadding callback.
......
......@@ -94,7 +94,7 @@ DecodeStatus PushPromisePayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPadLength;
return status;
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kStartDecodingPushPromiseFields:
status =
......@@ -106,7 +106,7 @@ DecodeStatus PushPromisePayloadDecoder::ResumeDecodingPayload(
// Finished decoding the Promised Stream ID. Can now tell the listener
// that we're starting to decode a PUSH_PROMISE frame.
ReportPushPromise(state);
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kReadPayload:
DCHECK_LT(state->remaining_payload(), frame_header.payload_length);
......@@ -129,7 +129,7 @@ DecodeStatus PushPromisePayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPayload;
return DecodeStatus::kDecodeInProgress;
}
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case PayloadState::kSkipPadding:
// SkipPadding handles the OnPadding callback.
......
......@@ -101,7 +101,7 @@ DecodeStatus HpackEntryDecoder::Resume(DecodeBuffer* db,
return status;
}
state_ = EntryDecoderState::kDecodedType;
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case EntryDecoderState::kDecodedType:
// entry_type_decoder_ returned kDecodeDone, now need to decide how
......@@ -128,7 +128,7 @@ DecodeStatus HpackEntryDecoder::Resume(DecodeBuffer* db,
return status;
}
state_ = EntryDecoderState::kStartDecodingValue;
// FALLTHROUGH_INTENDED
FALLTHROUGH;
case EntryDecoderState::kStartDecodingValue:
DVLOG(1) << "kStartDecodingValue: db->Remaining=" << db->Remaining();
......
......@@ -85,17 +85,16 @@ class HTTP2_EXPORT_PRIVATE HpackStringDecoder {
// The length is split across decode buffers.
return status;
}
// We've finished decoding the length, which spanned one or more
// bytes. Approximately 17% of strings have a length that is greater
// than 126 bytes, and thus the length is encoded in more than one
// byte, and so doesn't get the benefit of the optimization in
// Start() for single byte lengths. But, we still expect that most
// of such strings will be contained entirely in a single decode
// buffer, and hence this fall through skips another trip through the
// switch above and more importantly skips setting the state_ variable
// again in those cases where we don't need it.
// FALLTHROUGH_INTENDED
// We've finished decoding the length, which spanned one or more
// bytes. Approximately 17% of strings have a length that is greater
// than 126 bytes, and thus the length is encoded in more than one
// byte, and so doesn't get the benefit of the optimization in
// Start() for single byte lengths. But, we still expect that most
// of such strings will be contained entirely in a single decode
// buffer, and hence this fall through skips another trip through the
// switch above and more importantly skips setting the state_ variable
// again in those cases where we don't need it.
FALLTHROUGH;
case kDecodingString:
DVLOG(2) << "kDecodingString: db->Remaining=" << db->Remaining()
......
......@@ -481,7 +481,7 @@ int ProofVerifierChromium::Job::DoVerifyCertComplete(int result) {
break;
case TransportSecurityState::PKPStatus::BYPASSED:
verify_details_->pkp_bypassed = true;
// Fall through.
FALLTHROUGH;
case TransportSecurityState::PKPStatus::OK:
// Do nothing.
break;
......
......@@ -613,6 +613,7 @@ void BbrSender::UpdateRecoveryState(QuicPacketNumber last_acked_packet,
if (is_round_start) {
recovery_state_ = GROWTH;
}
FALLTHROUGH;
case GROWTH:
// Exit recovery if appropriate.
......
......@@ -37,7 +37,8 @@ SendAlgorithmInterface* SendAlgorithmInterface::Create(
initial_congestion_window,
max_congestion_window);
}
// Fall back to CUBIC if PCC is disabled.
// Fall back to CUBIC if PCC is disabled.
FALLTHROUGH;
case kCubicBytes:
return new TcpCubicSenderBytes(
clock, rtt_stats, false /* don't use Reno */,
......
......@@ -245,6 +245,7 @@ QuicErrorCode CryptoFramer::Process(QuicStringPiece input,
reader.ReadTag(&message_tag);
message_.set_tag(message_tag);
state_ = STATE_READING_NUM_ENTRIES;
FALLTHROUGH;
case STATE_READING_NUM_ENTRIES:
if (reader.BytesRemaining() < kNumEntriesSize + sizeof(uint16_t)) {
break;
......@@ -260,6 +261,7 @@ QuicErrorCode CryptoFramer::Process(QuicStringPiece input,
tags_and_lengths_.reserve(num_entries_);
state_ = STATE_READING_TAGS_AND_LENGTHS;
values_len_ = 0;
FALLTHROUGH;
case STATE_READING_TAGS_AND_LENGTHS: {
if (reader.BytesRemaining() <
num_entries_ * (kQuicTagSize + kCryptoEndOffsetSize)) {
......@@ -293,6 +295,7 @@ QuicErrorCode CryptoFramer::Process(QuicStringPiece input,
}
values_len_ = last_end_offset;
state_ = STATE_READING_VALUES;
FALLTHROUGH;
}
case STATE_READING_VALUES:
if (reader.BytesRemaining() < values_len_) {
......
......@@ -815,6 +815,7 @@ void QuicCryptoServerConfig::ProcessClientHelloAfterGetProof(
&params->token_binding_key_param, nullptr)) {
break;
}
FALLTHROUGH;
default:
helper.Fail(QUIC_INVALID_CRYPTO_MESSAGE_PARAMETER,
"Invalid Token Binding key parameter");
......
......@@ -153,6 +153,7 @@ class QuicSpdySession::SpdyFramerVisitor
if (GetQuicReloadableFlag(quic_send_max_header_list_size)) {
break;
}
FALLTHROUGH;
default:
CloseConnection(
QuicStrCat("Unsupported field of HTTP/2 SETTINGS frame: ", id),
......
......@@ -74,7 +74,7 @@ QuicHttpAltSvcQuicHttpPayloadDecoder::ResumeDecodingPayload(
switch (payload_state_) {
case PayloadState::kStartDecodingStruct:
status = state->StartDecodingStructureInPayload(&altsvc_fields_, db);
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kMaybeDecodedStruct:
if (status == QuicHttpDecodeStatus::kDecodeDone &&
......@@ -96,7 +96,7 @@ QuicHttpAltSvcQuicHttpPayloadDecoder::ResumeDecodingPayload(
DCHECK_GT(altsvc_fields_.origin_length, state->remaining_payload());
return state->ReportFrameSizeError();
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kDecodingStrings:
return DecodeStrings(state, db);
......
......@@ -103,7 +103,7 @@ QuicHttpDecodeStatus QuicHttpDataQuicHttpPayloadDecoder::ResumeDecodingPayload(
if (status != QuicHttpDecodeStatus::kDecodeDone) {
return status;
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kReadPayload:
avail = state->AvailablePayload(db);
......@@ -116,7 +116,7 @@ QuicHttpDecodeStatus QuicHttpDataQuicHttpPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPayload;
return QuicHttpDecodeStatus::kDecodeInProgress;
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kSkipPadding:
// SkipPadding handles the OnPadding callback.
......
......@@ -77,7 +77,7 @@ QuicHttpGoAwayQuicHttpPayloadDecoder::ResumeDecodingPayload(
switch (payload_state_) {
case PayloadState::kStartDecodingFixedFields:
status = state->StartDecodingStructureInPayload(&goaway_fields_, db);
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kHandleFixedFieldsStatus:
if (status == QuicHttpDecodeStatus::kDecodeDone) {
......@@ -95,7 +95,7 @@ QuicHttpGoAwayQuicHttpPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kResumeDecodingFixedFields;
return status;
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kReadOpaqueData:
// The opaque data is all the remains to be decoded, so anything left
......
......@@ -138,7 +138,7 @@ QuicHttpHeadersQuicHttpPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPayload;
continue;
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kStartDecodingPriorityFields:
status = state->StartDecodingStructureInPayload(&priority_fields_, db);
......@@ -147,7 +147,7 @@ QuicHttpHeadersQuicHttpPayloadDecoder::ResumeDecodingPayload(
return status;
}
state->listener()->OnHeadersPriority(priority_fields_);
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kReadPayload:
avail = state->AvailablePayload(db);
......@@ -160,7 +160,7 @@ QuicHttpHeadersQuicHttpPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPayload;
return QuicHttpDecodeStatus::kDecodeInProgress;
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kSkipPadding:
// SkipPadding handles the OnPadding callback.
......
......@@ -101,7 +101,7 @@ QuicHttpPushPromiseQuicHttpPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPadLength;
return status;
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kStartDecodingPushPromiseFields:
status =
......@@ -113,7 +113,7 @@ QuicHttpPushPromiseQuicHttpPayloadDecoder::ResumeDecodingPayload(
// Finished decoding the Promised Stream ID. Can now tell the listener
// that we're starting to decode a PUSH_PROMISE frame.
ReportPushPromise(state);
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kReadPayload:
DCHECK_LT(state->remaining_payload(), frame_header.payload_length);
......@@ -136,7 +136,7 @@ QuicHttpPushPromiseQuicHttpPayloadDecoder::ResumeDecodingPayload(
payload_state_ = PayloadState::kReadPayload;
return QuicHttpDecodeStatus::kDecodeInProgress;
}
// FALLTHROUGH_INTENDED;
FALLTHROUGH;
case PayloadState::kSkipPadding:
// SkipPadding handles the OnPadding callback.
......
......@@ -1327,7 +1327,7 @@ int SSLClientSocketImpl::DoVerifyCertComplete(int result) {
break;
case TransportSecurityState::PKPStatus::BYPASSED:
pkp_bypassed_ = true;
// Fall through.
FALLTHROUGH;
case TransportSecurityState::PKPStatus::OK:
// Do nothing.
break;
......
......@@ -147,7 +147,7 @@ LoadState SSLConnectJob::GetLoadState() const {
case STATE_TUNNEL_CONNECT_COMPLETE:
if (transport_socket_handle_->socket())
return LOAD_STATE_ESTABLISHING_PROXY_TUNNEL;
// else, fall through.
FALLTHROUGH;
case STATE_TRANSPORT_CONNECT:
case STATE_TRANSPORT_CONNECT_COMPLETE:
case STATE_SOCKS_CONNECT:
......
......@@ -848,7 +848,7 @@ void SSLServerContextImpl::Init() {
switch (ssl_server_config_.client_cert_type) {
case SSLServerConfig::ClientCertType::REQUIRE_CLIENT_CERT:
verify_mode |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT;
// Fall-through
FALLTHROUGH;
case SSLServerConfig::ClientCertType::OPTIONAL_CLIENT_CERT:
verify_mode |= SSL_VERIFY_PEER;
SSL_CTX_set_custom_verify(ssl_ctx_.get(), verify_mode,
......
......@@ -426,7 +426,7 @@ std::unique_ptr<SpdyFrameSequence> SpdyFramer::CreateIterator(
}
case SpdyFrameType::DATA: {
DVLOG(1) << "Serialize a stream end DATA frame for VTL";
// FALLTHROUGH_INTENDED
FALLTHROUGH;
}
default: {
return SpdyMakeUnique<SpdyControlFrameIterator>(framer,
......
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