ams: mark ams::Result [[nodiscard]] (partially complete).
NOTE: This work is not yet fully complete; kernel is done, but it was taking an exceedingly long time to get through libstratosphere. Thus, I've temporarily added -Wno-error=unused-result for libstratosphere/stratosphere. All warnings should be fixed to do the same thing Nintendo does as relevant, but this is taking a phenomenally long time and is not actually the most important work to do, so it can be put off for some time to prioritize other tasks for 21.0.0 support.
This commit is contained in:
@@ -32,15 +32,15 @@ namespace ams::htclow::driver {
|
||||
m_open_driver = m_debug_driver;
|
||||
break;
|
||||
case impl::DriverType::Socket:
|
||||
m_socket_driver.Open();
|
||||
R_TRY(m_socket_driver.Open());
|
||||
m_open_driver = std::addressof(m_socket_driver);
|
||||
break;
|
||||
case impl::DriverType::Usb:
|
||||
m_usb_driver.Open();
|
||||
R_TRY(m_usb_driver.Open());
|
||||
m_open_driver = std::addressof(m_usb_driver);
|
||||
break;
|
||||
case impl::DriverType::PlainChannel:
|
||||
//m_plain_channel_driver.Open();
|
||||
//R_TRY(m_plain_channel_driver.Open());
|
||||
//m_open_driver = std::addressof(m_plain_channel_driver);
|
||||
//break;
|
||||
R_THROW(htclow::ResultUnknownDriverType());
|
||||
|
||||
@@ -67,14 +67,20 @@ namespace ams::htclow::driver {
|
||||
}
|
||||
|
||||
void SocketDiscoveryManager::ThreadFunc() {
|
||||
for (this->DoDiscovery(); !m_driver_closed; this->DoDiscovery()) {
|
||||
/* Check if the driver is closed five times. */
|
||||
/* Do discovery. */
|
||||
static_cast<void>(this->DoDiscovery());
|
||||
|
||||
while (!m_driver_closed) {
|
||||
/* Check if the driver is closed 5 times. */
|
||||
for (size_t i = 0; i < 5; ++i) {
|
||||
os::SleepThread(TimeSpan::FromSeconds(1));
|
||||
if (m_driver_closed) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Do discovery. */
|
||||
static_cast<void>(this->DoDiscovery());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -407,11 +407,11 @@ namespace ams::htclow::driver {
|
||||
g_usb_break_event.Signal();
|
||||
os::WaitThread(std::addressof(g_usb_indication_thread));
|
||||
os::DestroyThread(std::addressof(g_usb_indication_thread));
|
||||
g_ds_client.DisableDevice();
|
||||
g_ds_endpoints[1].Finalize();
|
||||
g_ds_endpoints[0].Finalize();
|
||||
g_ds_interface.Finalize();
|
||||
g_ds_client.Finalize();
|
||||
static_cast<void>(g_ds_client.DisableDevice());
|
||||
static_cast<void>(g_ds_endpoints[1].Finalize());
|
||||
static_cast<void>(g_ds_endpoints[0].Finalize());
|
||||
static_cast<void>(g_ds_interface.Finalize());
|
||||
static_cast<void>(g_ds_client.Finalize());
|
||||
g_usb_interface_initialized = false;
|
||||
}
|
||||
|
||||
@@ -454,8 +454,8 @@ namespace ams::htclow::driver {
|
||||
|
||||
void CancelUsbSendReceive() {
|
||||
if (g_usb_interface_initialized) {
|
||||
g_ds_endpoints[0].Cancel();
|
||||
g_ds_endpoints[1].Cancel();
|
||||
static_cast<void>(g_ds_endpoints[0].Cancel());
|
||||
static_cast<void>(g_ds_endpoints[1].Cancel());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
void Channel::Close() {
|
||||
m_manager->Close(impl::ConvertChannelType(m_channel));
|
||||
static_cast<void>(m_manager->Close(impl::ConvertChannelType(m_channel)));
|
||||
}
|
||||
|
||||
ChannelState Channel::GetChannelState() {
|
||||
@@ -72,7 +72,7 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
void Channel::Shutdown() {
|
||||
m_manager->Shutdown(impl::ConvertChannelType(m_channel));
|
||||
static_cast<void>(m_manager->Shutdown(impl::ConvertChannelType(m_channel)));
|
||||
}
|
||||
|
||||
Result Channel::Receive(s64 *out, void *dst, s64 size, ReceiveOption option) {
|
||||
@@ -221,7 +221,7 @@ namespace ams::htclow {
|
||||
/* Perform the wait. */
|
||||
if (event != nullptr) {
|
||||
if (os::WaitAny(event, m_manager->GetTaskEvent(task_id)) == 0) {
|
||||
m_manager->WaitReceiveEnd(task_id);
|
||||
static_cast<void>(m_manager->WaitReceiveEnd(task_id));
|
||||
R_THROW(htclow::ResultChannelWaitCancelled());
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -64,13 +64,13 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
void Worker::ReceiveThread() {
|
||||
this->ProcessReceive();
|
||||
static_cast<void>(this->ProcessReceive());
|
||||
m_driver->CancelSendReceive();
|
||||
this->Cancel();
|
||||
}
|
||||
|
||||
void Worker::SendThread() {
|
||||
this->ProcessSend();
|
||||
static_cast<void>(this->ProcessSend());
|
||||
m_driver->CancelSendReceive();
|
||||
this->Cancel();
|
||||
}
|
||||
@@ -114,7 +114,9 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
/* Process the received packet. */
|
||||
m_service->ProcessReceivePacket(header, m_receive_packet_body, header.body_size);
|
||||
if (R_FAILED(m_service->ProcessReceivePacket(header, m_receive_packet_body, header.body_size))) {
|
||||
/* TODO: PrintIgnorePacket */
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
@@ -129,7 +131,9 @@ namespace ams::htclow {
|
||||
}
|
||||
|
||||
/* Process the received packet. */
|
||||
m_mux->ProcessReceivePacket(header, m_receive_packet_body, header.body_size);
|
||||
if (R_FAILED(m_mux->ProcessReceivePacket(header, m_receive_packet_body, header.body_size))) {
|
||||
/* TODO: PrintIgnorePacket */
|
||||
}
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,9 @@ namespace ams::htclow::mux {
|
||||
R_RETURN(m_channel_impl_map[it->second].ProcessReceivePacket(header, body, body_size));
|
||||
} else {
|
||||
if (header.packet_type == PacketType_Data || header.packet_type == PacketType_MaxData) {
|
||||
this->SendErrorPacket(header.channel);
|
||||
if (R_FAILED(this->SendErrorPacket(header.channel))) {
|
||||
/* Nintendo doesn't do anything here. */
|
||||
}
|
||||
}
|
||||
R_THROW(htclow::ResultChannelNotExist());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user