Skip to content

Commit

Permalink
Use NOTREACHED_IN_MIGRATION() in net/
Browse files Browse the repository at this point in the history
This was generated by replacing "  NOTREACHED()" with
"  NOTREACHED_IN_MIGRATION()" and running git cl format.

This prepares for making NOTREACHED() [[noreturn]] alongside
NotReachedIsFatal migration of existing inventory.

Bug: 40580068
Change-Id: I79d775410e9642ca648b75e91137d3948b2d45dd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5539624
Commit-Queue: Peter Boström <[email protected]>
Reviewed-by: Lei Zhang <[email protected]>
Commit-Queue: Lei Zhang <[email protected]>
Auto-Submit: Peter Boström <[email protected]>
Owners-Override: Lei Zhang <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1300940}
  • Loading branch information
pbos authored and Chromium LUCI CQ committed May 14, 2024
1 parent a5146dc commit b5035d5
Show file tree
Hide file tree
Showing 191 changed files with 445 additions and 435 deletions.
2 changes: 1 addition & 1 deletion net/android/network_change_notifier_android_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ class BaseNetworkChangeNotifierAndroidTest : public TestWithTaskEnvironment {
delegate_.FakeDefaultNetwork(network, type);
break;
case NONE:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
break;
}
// See comment above.
Expand Down
6 changes: 4 additions & 2 deletions net/android/network_change_notifier_delegate_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ NetworkChangeNotifier::ConnectionType ConvertConnectionType(
case NetworkChangeNotifier::CONNECTION_BLUETOOTH:
break;
default:
NOTREACHED() << "Unknown connection type received: " << connection_type;
NOTREACHED_IN_MIGRATION()
<< "Unknown connection type received: " << connection_type;
return NetworkChangeNotifier::CONNECTION_UNKNOWN;
}
return static_cast<NetworkChangeNotifier::ConnectionType>(connection_type);
Expand All @@ -53,7 +54,8 @@ NetworkChangeNotifier::ConnectionCost ConvertConnectionCost(
case NetworkChangeNotifier::CONNECTION_COST_METERED:
break;
default:
NOTREACHED() << "Unknown connection cost received: " << connection_cost;
NOTREACHED_IN_MIGRATION()
<< "Unknown connection cost received: " << connection_cost;
return NetworkChangeNotifier::CONNECTION_COST_UNKNOWN;
}
return static_cast<NetworkChangeNotifier::ConnectionCost>(connection_cost);
Expand Down
4 changes: 2 additions & 2 deletions net/base/address_family.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ int ConvertAddressFamily(AddressFamily address_family) {
case ADDRESS_FAMILY_IPV6:
return AF_INET6;
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return AF_UNSPEC;
}

Expand All @@ -42,7 +42,7 @@ AddressFamily ToAddressFamily(int family) {
case AF_UNSPEC:
return ADDRESS_FAMILY_UNSPECIFIED;
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return ADDRESS_FAMILY_UNSPECIFIED;
}

Expand Down
3 changes: 2 additions & 1 deletion net/base/backoff_entry_serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ std::unique_ptr<BackoffEntry> BackoffEntrySerializer::DeserializeFromList(
break;
}
default:
NOTREACHED() << "Unexpected version_number: " << version_number;
NOTREACHED_IN_MIGRATION()
<< "Unexpected version_number: " << version_number;
}

if (!serialized[3].is_string())
Expand Down
2 changes: 1 addition & 1 deletion net/base/directory_lister.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void SortData(std::vector<DirectoryLister::DirectoryListerData>* data,
std::sort(data->begin(), data->end(), CompareAlphaDirsFirst);
} else if (listing_type != DirectoryLister::NO_SORT &&
listing_type != DirectoryLister::NO_SORT_RECURSIVE) {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
}
}

Expand Down
2 changes: 1 addition & 1 deletion net/base/hash_value.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ bool operator<(const HashValue& lhs, const HashValue& rhs) {
return lhs.fingerprint.sha256 < rhs.fingerprint.sha256;
}

NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion net/base/ip_address.cc
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ size_t CommonPrefixLength(const IPAddress& a1, const IPAddress& a2) {
return i * CHAR_BIT + j;
diff <<= 1;
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
}
return a1.size() * CHAR_BIT;
}
Expand Down
2 changes: 1 addition & 1 deletion net/base/ip_endpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int IPEndPoint::GetSockAddrFamily() const {
return AF_BTH;
#endif
default:
NOTREACHED() << "Bad IP address";
NOTREACHED_IN_MIGRATION() << "Bad IP address";
return AF_UNSPEC;
}
}
Expand Down
2 changes: 1 addition & 1 deletion net/base/ip_endpoint_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const uint16_t* GetPortFieldFromSockaddr(const struct sockaddr* address,
reinterpret_cast<const struct sockaddr_in6*>(address);
return &sockaddr->sin6_port;
} else {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return nullptr;
}
}
Expand Down
6 changes: 3 additions & 3 deletions net/base/mime_sniffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ static bool SniffForOfficeDocs(std::string_view content,
*result = "application/vnd.ms-powerpoint";
return true;
case DOC_TYPE_NONE:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
}
} else if (office_version == "OOXML") {
Expand All @@ -446,12 +446,12 @@ static bool SniffForOfficeDocs(std::string_view content,
"presentationml.presentation";
return true;
case DOC_TYPE_NONE:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
}
}

NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions net/base/net_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Error FileErrorToNetError(base::File::Error file_error) {
case base::File::FILE_ERROR_SECURITY:
return ERR_ACCESS_DENIED;
case base::File::FILE_ERROR_MAX:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
[[fallthrough]];
case base::File::FILE_ERROR_NOT_A_DIRECTORY:
case base::File::FILE_ERROR_NOT_A_FILE:
Expand All @@ -128,7 +128,7 @@ Error FileErrorToNetError(base::File::Error file_error) {
case base::File::FILE_ERROR_FAILED:
return ERR_FAILED;
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return ERR_FAILED;
}

Expand Down
4 changes: 2 additions & 2 deletions net/base/network_change_notifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ double NetworkChangeNotifier::GetMaxBandwidthMbpsForConnectionSubtype(
case SUBTYPE_OTHER:
return std::numeric_limits<double>::infinity();
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return std::numeric_limits<double>::infinity();
}

Expand Down Expand Up @@ -514,7 +514,7 @@ const char* NetworkChangeNotifier::ConnectionTypeToString(
NetworkChangeNotifier::CONNECTION_LAST + 1,
"ConnectionType name count should match");
if (type < CONNECTION_UNKNOWN || type > CONNECTION_LAST) {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return "CONNECTION_INVALID";
}
return kConnectionTypeNames[type];
Expand Down
9 changes: 5 additions & 4 deletions net/base/network_change_notifier_apple.mm
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ static bool CalculateReachability(SCNetworkConnectionFlags flags) {
current_network = 5;
} else {
// New technology?
NOTREACHED() << "Unknown network technology: " << network_type;
NOTREACHED_IN_MIGRATION()
<< "Unknown network technology: " << network_type;
return CONNECTION_UNKNOWN;
}
if (current_network > best_network) {
Expand Down Expand Up @@ -335,7 +336,7 @@ static bool CalculateReachability(SCNetworkConnectionFlags flags) {
base::apple::ScopedCFTypeRef<SCDynamicStoreRef> store) {
#if BUILDFLAG(IS_IOS)
// SCDynamicStore API does not exist on iOS.
NOTREACHED();
NOTREACHED_IN_MIGRATION();
#elif BUILDFLAG(IS_MAC)
NSArray* notification_keys = @[
base::apple::CFToNSOwnershipCast(SCDynamicStoreKeyCreateNetworkGlobalEntity(
Expand Down Expand Up @@ -372,7 +373,7 @@ static bool CalculateReachability(SCNetworkConnectionFlags flags) {
void NetworkChangeNotifierApple::OnNetworkConfigChange(CFArrayRef changed_keys) {
#if BUILDFLAG(IS_IOS)
// SCDynamicStore API does not exist on iOS.
NOTREACHED();
NOTREACHED_IN_MIGRATION();
#elif BUILDFLAG(IS_MAC)
DCHECK_EQ(run_loop_.get(), CFRunLoopGetCurrent());

Expand All @@ -389,7 +390,7 @@ static bool CalculateReachability(SCNetworkConnectionFlags flags) {
// TODO(willchan): Does not appear to be working. Look into this.
// Perhaps this isn't needed anyway.
} else {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
}
}
if (!maybe_notify) {
Expand Down
4 changes: 2 additions & 2 deletions net/base/network_interfaces_getifaddrs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
// under the name Getifaddrs.
getifaddrs_result = Getifaddrs(&interfaces);
#else
NOTREACHED();
NOTREACHED_IN_MIGRATION();
#endif
} else {
getifaddrs_result = getifaddrs(&interfaces);
Expand All @@ -273,7 +273,7 @@ bool GetNetworkList(NetworkInterfaceList* networks, int policy) {
#if BUILDFLAG(IS_ANDROID)
Freeifaddrs(interfaces);
#else
NOTREACHED();
NOTREACHED_IN_MIGRATION();
#endif
} else {
freeifaddrs(interfaces);
Expand Down
4 changes: 2 additions & 2 deletions net/base/platform_mime_util_apple.mm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
return true;
}
#else
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
#endif // (BUILDFLAG(IS_MAC) && MAC_OS_X_VERSION_MIN_REQUIRED <
// MAC_OS_VERSION_11_0) || (BUILDFLAG(IS_IOS) &&
Expand Down Expand Up @@ -121,7 +121,7 @@
}

#else
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
#endif // (BUILDFLAG(IS_MAC) && MAC_OS_X_VERSION_MIN_REQUIRED <
// MAC_OS_VERSION_11_0) || (BUILDFLAG(IS_IOS) &&
Expand Down
2 changes: 1 addition & 1 deletion net/base/port_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ ScopedPortException::~ScopedPortException() {
if (it != g_explicitly_allowed_ports.Get().end())
g_explicitly_allowed_ports.Get().erase(it);
else
NOTREACHED();
NOTREACHED_IN_MIGRATION();
}

NET_EXPORT bool IsAllowablePort(int port) {
Expand Down
2 changes: 1 addition & 1 deletion net/base/privacy_mode.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const char* PrivacyModeToDebugString(PrivacyMode privacy_mode) {
case PRIVACY_MODE_ENABLED_PARTITIONED_STATE_ALLOWED:
return "enabled partitioned state allowed";
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return "";
}

Expand Down
4 changes: 2 additions & 2 deletions net/base/proxy_string_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ std::string ProxyServerToPacResultElement(const ProxyServer& proxy_server) {
proxy_server.GetPort());
default:
// Got called with an invalid scheme.
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return std::string();
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ std::string ProxyServerToProxyUri(const ProxyServer& proxy_server) {
proxy_server.GetPort());
default:
// Got called with an invalid scheme.
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return std::string();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ RegistryLengthOutput GetRegistryLengthInTrimmedHost(
// such as *.foo.invalid, also have their parent, foo.invalid, as an entry
// on the PSL, which is why it returns the length of foo.invalid. This
// isn't entirely correct.
NOTREACHED() << "Invalid exception rule";
NOTREACHED_IN_MIGRATION() << "Invalid exception rule";
return {length, false};
}
return {host.length() - first_dot - 1, false};
Expand Down Expand Up @@ -347,7 +347,7 @@ size_t DoPermissiveGetHostRegistryLength(T host,
}
}

NOTREACHED();
NOTREACHED_IN_MIGRATION();
return canonical_rcd_len;
}

Expand Down Expand Up @@ -450,7 +450,7 @@ bool HostHasRegistryControlledDomain(std::string_view host,
.registry_length;
break;
default:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
}
return (rcd_length != 0) && (rcd_length != std::string::npos);
Expand Down
2 changes: 1 addition & 1 deletion net/base/request_priority.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const char* RequestPriorityToString(RequestPriority priority) {
case HIGHEST:
return "HIGHEST";
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return "UNKNOWN_PRIORITY";
}

Expand Down
2 changes: 1 addition & 1 deletion net/base/test_completion_callback_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ bool ExampleEmployer::DoSomething(CompletionOnceCallback callback) {

if (!base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
FROM_HERE, base::BindOnce(&ExampleWorker::DoWork, request_))) {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
request_ = nullptr;
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion net/base/transport_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ std::string_view TransportTypeToString(TransportType type) {
// We define this here instead of as a `default` clause above so as to force
// a compiler error if a new value is added to the enum and this method is
// not updated to reflect it.
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return "<invalid transport type>";
}

Expand Down
2 changes: 1 addition & 1 deletion net/base/upload_file_element_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int UploadFileElementReader::DoLoop(int result) {
next_state_ = State::IDLE;
switch (state) {
case State::IDLE:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
break;
case State::OPEN:
// Ignore previous result here. It's typically OK, but if Init()
Expand Down
2 changes: 1 addition & 1 deletion net/cert/cert_database_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ OSStatus Notifier::KeychainCallback(SecKeychainEvent keychain_event,
SecKeychainCallbackInfo* info,
void* context) {
if (info->version > SEC_KEYCHAIN_SETTINGS_VERS1) {
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return errSecWrongSecVersion;
}

Expand Down
2 changes: 1 addition & 1 deletion net/cert/cert_status_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int MapCertStatusToNetError(CertStatus cert_status) {
return ERR_CERT_NO_REVOCATION_MECHANISM;

// Unknown status. The assumption is 0 (an OK status) won't be used here.
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return ERR_UNEXPECTED;
}

Expand Down
2 changes: 1 addition & 1 deletion net/cert/cert_verify_proc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void RecordTrustAnchorHistogram(const HashValueVector& spki_hashes,
return true;
}

NOTREACHED();
NOTREACHED_IN_MIGRATION();
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions net/cert/cert_verify_proc_android.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ std::shared_ptr<const bssl::ParsedCertificate> FindLastCertWithUnknownIssuer(
// Continue the search for |last_issuer|'s issuer.
last = last_issuer;
}
NOTREACHED();
NOTREACHED_IN_MIGRATION();
return nullptr;
}

Expand Down Expand Up @@ -238,7 +238,7 @@ android::CertVerifyStatusAndroid TryVerifyWithAIAFetching(
last_cert_with_unknown_issuer = new_last_cert_with_unknown_issuer;
}

NOTREACHED();
NOTREACHED_IN_MIGRATION();
return android::CERT_VERIFY_STATUS_ANDROID_NO_TRUSTED_ROOT;
}

Expand Down Expand Up @@ -285,7 +285,7 @@ bool VerifyFromAndroidTrustManager(
verify_result->cert_status |= CERT_STATUS_INVALID;
break;
default:
NOTREACHED();
NOTREACHED_IN_MIGRATION();
verify_result->cert_status |= CERT_STATUS_INVALID;
break;
}
Expand Down
Loading

0 comments on commit b5035d5

Please sign in to comment.