mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
refactor: only use [[maybe_unused]] if arg might be used (#2033)
* refactor: [[maybe_unused]] iff arg _might_ be used If the arg is never used, comment out its name. If the arg is _sometimes_ used e.g. with ifdefs, use [[maybe_unused]].
This commit is contained in:
@@ -72,7 +72,7 @@ static void send_signal_to_pipe(int sig)
|
||||
errno = old_errno;
|
||||
}
|
||||
|
||||
static void* signal_handler_thread_main([[maybe_unused]] void* arg)
|
||||
static void* signal_handler_thread_main(void* /*arg*/)
|
||||
{
|
||||
int sig;
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ static void do_log_system_error(char const* file, int line, tr_log_level level,
|
||||
****
|
||||
***/
|
||||
|
||||
static BOOL WINAPI handle_console_ctrl([[maybe_unused]] DWORD control_type)
|
||||
static BOOL WINAPI handle_console_ctrl(DWORD /*control_type*/)
|
||||
{
|
||||
callbacks->on_stop(callback_arg);
|
||||
return TRUE;
|
||||
@@ -145,11 +145,7 @@ static void stop_service(void)
|
||||
}
|
||||
}
|
||||
|
||||
static DWORD WINAPI handle_service_ctrl(
|
||||
DWORD control_code,
|
||||
[[maybe_unused]] DWORD event_type,
|
||||
[[maybe_unused]] LPVOID event_data,
|
||||
[[maybe_unused]] LPVOID context)
|
||||
static DWORD WINAPI handle_service_ctrl(DWORD control_code, DWORD /*event_type*/, LPVOID /*event_data*/, LPVOID /*context*/)
|
||||
{
|
||||
switch (control_code)
|
||||
{
|
||||
@@ -171,12 +167,12 @@ static DWORD WINAPI handle_service_ctrl(
|
||||
return ERROR_CALL_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
static unsigned int __stdcall service_thread_main([[maybe_unused]] void* context)
|
||||
static unsigned int __stdcall service_thread_main(void* /*context*/)
|
||||
{
|
||||
return callbacks->on_start(callback_arg, false);
|
||||
}
|
||||
|
||||
static VOID WINAPI service_main([[maybe_unused]] DWORD argc, [[maybe_unused]] LPWSTR* argv)
|
||||
static VOID WINAPI service_main(DWORD /*argc*/, LPWSTR* /*argv*/)
|
||||
{
|
||||
status_handle = RegisterServiceCtrlHandlerExW(service_name, &handle_service_ctrl, nullptr);
|
||||
|
||||
|
||||
@@ -42,11 +42,11 @@ using namespace std::literals;
|
||||
|
||||
#else
|
||||
|
||||
static void sd_notify([[maybe_unused]] int status, [[maybe_unused]] char const* str)
|
||||
static void sd_notify(int /*status*/, char const* /*str*/)
|
||||
{
|
||||
}
|
||||
|
||||
static void sd_notifyf([[maybe_unused]] int status, [[maybe_unused]] char const* fmt, ...)
|
||||
static void sd_notifyf(int /*status*/, char const* /*fmt*/, ...)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -379,17 +379,17 @@ static void reportStatus(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void periodicUpdate([[maybe_unused]] evutil_socket_t fd, [[maybe_unused]] short what, [[maybe_unused]] void* context)
|
||||
static void periodicUpdate(evutil_socket_t /*fd*/, short /*what*/, void* /*context*/)
|
||||
{
|
||||
pumpLogMessages(logfile);
|
||||
reportStatus();
|
||||
}
|
||||
|
||||
static tr_rpc_callback_status on_rpc_callback(
|
||||
[[maybe_unused]] tr_session* session,
|
||||
tr_session* /*session*/,
|
||||
tr_rpc_callback_type type,
|
||||
[[maybe_unused]] struct tr_torrent* tor,
|
||||
[[maybe_unused]] void* user_data)
|
||||
tr_torrent* /*tor*/,
|
||||
void* /*user_data*/)
|
||||
{
|
||||
if (type == TR_RPC_SESSION_CLOSE)
|
||||
{
|
||||
@@ -614,7 +614,7 @@ struct daemon_data
|
||||
bool paused;
|
||||
};
|
||||
|
||||
static void daemon_reconfigure([[maybe_unused]] void* arg)
|
||||
static void daemon_reconfigure(void* /*arg*/)
|
||||
{
|
||||
if (mySession == nullptr)
|
||||
{
|
||||
@@ -643,7 +643,7 @@ static void daemon_reconfigure([[maybe_unused]] void* arg)
|
||||
}
|
||||
}
|
||||
|
||||
static void daemon_stop([[maybe_unused]] void* arg)
|
||||
static void daemon_stop(void* /*arg*/)
|
||||
{
|
||||
event_base_loopexit(ev_base, nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user