Skip to content

Commit

Permalink
add -Wunused-parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras committed Dec 9, 2023
1 parent 45d2778 commit ce69142
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/rapi/rc_api_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,13 @@ int rc_json_get_required_array(uint32_t* num_entries, rc_json_field_t* array_fie
return 0;
#endif

if (!rc_json_get_optional_array(num_entries, array_field, response, field, field_name))
if (!rc_json_get_optional_array(num_entries, array_field, field, field_name))
return rc_json_missing_field(response, field);

return 1;
}

int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* array_field, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name) {
int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* array_field, const rc_json_field_t* field, const char* field_name) {
#ifndef NDEBUG
if (strcmp(field->name, field_name) != 0)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/rapi/rc_api_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void rc_json_get_optional_num(int32_t* out, const rc_json_field_t* field, const
void rc_json_get_optional_unum(uint32_t* out, const rc_json_field_t* field, const char* field_name, uint32_t default_value);
void rc_json_get_optional_float(float* out, const rc_json_field_t* field, const char* field_name, float default_value);
void rc_json_get_optional_bool(int* out, const rc_json_field_t* field, const char* field_name, int default_value);
int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* iterator, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name);
int rc_json_get_optional_array(uint32_t* num_entries, rc_json_field_t* iterator, const rc_json_field_t* field, const char* field_name);
int rc_json_get_required_string(const char** out, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name);
int rc_json_get_required_num(int32_t* out, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name);
int rc_json_get_required_unum(uint32_t* out, rc_api_response_t* response, const rc_json_field_t* field, const char* field_name);
Expand Down
4 changes: 2 additions & 2 deletions src/rapi/rc_api_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ int rc_api_process_start_session_server_response(rc_api_start_session_response_t
if (result != RC_OK || !response->response.succeeded)
return result;

if (rc_json_get_optional_array(&response->num_unlocks, &array_field, &response->response, &fields[2], "Unlocks") && response->num_unlocks) {
if (rc_json_get_optional_array(&response->num_unlocks, &array_field, &fields[2], "Unlocks") && response->num_unlocks) {
response->unlocks = (rc_api_unlock_entry_t*)rc_buffer_alloc(&response->response.buffer, response->num_unlocks * sizeof(rc_api_unlock_entry_t));
if (!response->unlocks)
return RC_OUT_OF_MEMORY;
Expand All @@ -167,7 +167,7 @@ int rc_api_process_start_session_server_response(rc_api_start_session_response_t
}
}

if (rc_json_get_optional_array(&response->num_hardcore_unlocks, &array_field, &response->response, &fields[3], "HardcoreUnlocks") && response->num_hardcore_unlocks) {
if (rc_json_get_optional_array(&response->num_hardcore_unlocks, &array_field, &fields[3], "HardcoreUnlocks") && response->num_hardcore_unlocks) {
response->hardcore_unlocks = (rc_api_unlock_entry_t*)rc_buffer_alloc(&response->response.buffer, response->num_hardcore_unlocks * sizeof(rc_api_unlock_entry_t));
if (!response->hardcore_unlocks)
return RC_OUT_OF_MEMORY;
Expand Down
20 changes: 20 additions & 0 deletions src/rc_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ static void rc_client_submit_leaderboard_entry_retry(rc_client_scheduled_callbac

static void rc_client_dummy_event_handler(const rc_client_event_t* event, rc_client_t* client)
{
(void)event;
(void)client;
}

rc_client_t* rc_client_create(rc_client_read_memory_func_t read_memory_function, rc_client_server_call_t server_call_function)
Expand Down Expand Up @@ -246,6 +248,8 @@ static rc_clock_t rc_client_clock_get_now_millisecs(const rc_client_t* client)
{
#if defined(CLOCK_MONOTONIC)
struct timespec now;
(void)client;

if (clock_gettime(CLOCK_MONOTONIC, &now) < 0)
return 0;

Expand All @@ -255,6 +259,8 @@ static rc_clock_t rc_client_clock_get_now_millisecs(const rc_client_t* client)
static LARGE_INTEGER freq;
LARGE_INTEGER ticks;

(void)client;

/* Frequency is the number of ticks per second and is guaranteed to not change. */
if (!freq.QuadPart) {
if (!QueryPerformanceFrequency(&freq))
Expand All @@ -270,6 +276,9 @@ static rc_clock_t rc_client_clock_get_now_millisecs(const rc_client_t* client)
return (rc_clock_t)(ticks.QuadPart / freq.QuadPart);
#else
const clock_t clock_now = clock();

(void)client;

if (sizeof(clock_t) == 4) {
static uint32_t clock_wraps = 0;
static clock_t last_clock = 0;
Expand Down Expand Up @@ -408,6 +417,8 @@ static const char* rc_client_server_error_message(int* result, int http_status_c
return response->error_message;
}

(void)http_status_code;

if (*result != RC_OK)
return rc_error_str(*result);

Expand Down Expand Up @@ -3200,6 +3211,9 @@ static void rc_client_award_achievement_retry(rc_client_scheduled_callback_data_
rc_client_award_achievement_callback_data_t* ach_data =
(rc_client_award_achievement_callback_data_t*)callback_data->data;

(void)client;
(void)now;

rc_client_award_achievement_server_call(ach_data);
}

Expand Down Expand Up @@ -3828,6 +3842,9 @@ static void rc_client_submit_leaderboard_entry_retry(rc_client_scheduled_callbac
rc_client_submit_leaderboard_entry_callback_data_t* lboard_data =
(rc_client_submit_leaderboard_entry_callback_data_t*)callback_data->data;

(void)client;
(void)now;

rc_client_submit_leaderboard_entry_server_call(lboard_data);
}

Expand Down Expand Up @@ -4582,6 +4599,9 @@ static void rc_client_progress_tracker_timer_elapsed(rc_client_scheduled_callbac
rc_client_event_t client_event;
memset(&client_event, 0, sizeof(client_event));

(void)callback_data;
(void)now;

rc_mutex_lock(&client->state.mutex);
if (client->game->progress_tracker.action == RC_CLIENT_PROGRESS_TRACKER_ACTION_NONE) {
client->game->progress_tracker.hide_callback->when = 0;
Expand Down
3 changes: 2 additions & 1 deletion test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ else
endif

# more strict validation for source files to eliminate warnings/errors in upstream consumers
SRC_CFLAGS=-pedantic -Wsign-compare -Wtype-limits -Wimplicit-fallthrough=3 -Wunused-parameter
# 3DS build (retroarch) doesn't support signed char
SRC_CFLAGS=-pedantic -Wsign-compare -Wtype-limits -Wimplicit-fallthrough=3 -fno-signed-char
SRC_CFLAGS += -fno-signed-char

ifeq ($(BUILD), c89)
CFLAGS += -std=c89
Expand Down

0 comments on commit ce69142

Please sign in to comment.