From 4df6d287e32e6ba24f77e43b8ed0885739ed8621 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 3 Feb 2021 11:48:33 +0100 Subject: [PATCH] (Clang) Silence 'n' is never used warnings --- cheevos/cheevos.c | 1 + core_backup.c | 5 +++-- menu/cbs/menu_cbs_sublabel.c | 2 +- menu/drivers/materialui.c | 6 ++++-- menu/menu_displaylist.c | 26 ++++++++++++++++++++------ retroarch.c | 1 + runtime_file.c | 20 +++++++++++++++++++- 7 files changed, 49 insertions(+), 12 deletions(-) diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index b4e061be05..c8557b0bf2 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -217,6 +217,7 @@ static void rcheevos_get_user_agent( { frontend->get_os(tmp, sizeof(tmp), &major, &minor); ptr += sprintf(ptr, " (%s %d.%d)", tmp, major, minor); + (void)ptr; } } diff --git a/core_backup.c b/core_backup.c index be5a6254ce..6709d6fc3f 100644 --- a/core_backup.c +++ b/core_backup.c @@ -168,6 +168,7 @@ bool core_backup_get_backup_path( if ((n < 0) || (n >= 128)) n = 0; /* Silence GCC warnings... */ + (void)n; /* Build final path */ fill_pathname_join(backup_path, backup_dir, backup_filename, len); @@ -742,7 +743,7 @@ bool core_backup_list_get_entry_timestamp_str( if ((n < 0) || (n >= 32)) n = 0; /* Silence GCC warnings... */ - + (void)n; return true; } @@ -762,6 +763,6 @@ bool core_backup_list_get_entry_crc_str( if ((n < 0) || (n >= 32)) n = 0; /* Silence GCC warnings... */ - + (void)n; return true; } diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index fb03679053..163ebc95e7 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -1397,7 +1397,7 @@ static int action_bind_sublabel_playlist_entry( if ((n < 0) || (n >= 64)) n = 0; /* Silence GCC warnings... */ - + (void)n; if (!string_is_empty(tmp)) strlcat(s, tmp, len); } diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 7dd624960c..2374878296 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -3367,7 +3367,8 @@ static bool materialui_render_process_entry_playlist_desktop( if ((n < 0) || (n >= 255)) n = 0; /* Silence GCC warnings... */ - + (void)n; + /* All metadata is cached */ mui->status_bar.cached = true; @@ -7074,7 +7075,7 @@ static void materialui_status_bar_init( if ((n < 0) || (n >= 255)) n = 0; /* Silence GCC warnings... */ - + (void)n; n = snprintf(mui->status_bar.last_played_fallback_str, sizeof(mui->status_bar.last_played_fallback_str), "%s %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), @@ -7082,6 +7083,7 @@ static void materialui_status_bar_init( if ((n < 0) || (n >= 255)) n = 0; /* Silence GCC warnings... */ + (void)n; } } diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 16c5eae962..ef8cc2d346 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3764,6 +3764,7 @@ static unsigned menu_displaylist_parse_content_information( tmp[0] = '\0'; n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_LABEL), sizeof(tmp)); + (void)n; strlcat(tmp, ": ", sizeof(tmp)); n = strlcat(tmp, content_label, sizeof(tmp)); @@ -3771,7 +3772,7 @@ static unsigned menu_displaylist_parse_content_information( * (getting so sick of these...) */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) n = 0; - + (void)n; if (menu_entries_append_enum(info->list, tmp, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_LABEL), MENU_ENUM_LABEL_CONTENT_INFO_LABEL, @@ -3785,14 +3786,17 @@ static unsigned menu_displaylist_parse_content_information( tmp[0] = '\0'; n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_PATH), sizeof(tmp)); + (void)n; n = strlcat(tmp, ": ", sizeof(tmp)); + (void)n; n = strlcat(tmp, content_path, sizeof(tmp)); - + /* Silence gcc compiler warning * (getting so sick of these...) */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) n = 0; - + (void)n; + if (menu_entries_append_enum(info->list, tmp, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_PATH), MENU_ENUM_LABEL_CONTENT_INFO_PATH, @@ -3807,14 +3811,17 @@ static unsigned menu_displaylist_parse_content_information( tmp[0] = '\0'; n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CORE_NAME), sizeof(tmp)); + (void)n; n = strlcat(tmp, ": ", sizeof(tmp)); + (void)n; n = strlcat(tmp, core_name, sizeof(tmp)); /* Silence gcc compiler warning * (getting so sick of these...) */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) n = 0; - + (void)n; + if (menu_entries_append_enum(info->list, tmp, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_CORE_NAME), MENU_ENUM_LABEL_CONTENT_INFO_CORE_NAME, @@ -3876,14 +3883,17 @@ static unsigned menu_displaylist_parse_content_information( tmp[0] = '\0'; n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH), sizeof(tmp)); + (void)n; n = strlcat(tmp, ": ", sizeof(tmp)); + (void)n; n = strlcat(tmp, rcheevos_get_hash(), sizeof(tmp)); /* Silence gcc compiler warning * (getting so sick of these...) */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) n = 0; - + (void)n; + if (menu_entries_append_enum(info->list, tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH), MENU_ENUM_LABEL_VALUE_CONTENT_INFO_CHEEVOS_HASH, @@ -3911,14 +3921,17 @@ static unsigned menu_displaylist_parse_content_information( tmp[0] = '\0'; n = strlcpy(tmp, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CONTENT_INFO_DATABASE), sizeof(tmp)); + (void)n; n = strlcat(tmp, ": ", sizeof(tmp)); + (void)n; n = strlcat(tmp, db_name_no_ext, sizeof(tmp)); /* Silence gcc compiler warning * (getting so sick of these...) */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) n = 0; - + (void)n; + if (menu_entries_append_enum(info->list, tmp, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_INFO_DATABASE), MENU_ENUM_LABEL_CONTENT_INFO_DATABASE, @@ -6688,6 +6701,7 @@ unsigned menu_displaylist_build_list( /* Suppress GCC warnings... */ if ((n < 0) || (n >= PATH_MAX_LENGTH)) n = 0; + (void)n; } else snprintf( diff --git a/retroarch.c b/retroarch.c index bedad2bb04..2fa15bb2f4 100644 --- a/retroarch.c +++ b/retroarch.c @@ -12255,6 +12255,7 @@ static void command_event_runtime_log_deinit(struct rarch_state *p_rarch) hours, minutes, seconds); if ((n < 0) || (n >= PATH_MAX_LENGTH)) n = 0; /* Just silence any potential gcc warnings... */ + (void)n; RARCH_LOG("%s\n",log); /* Only write to file if content has run for a non-zero length of time */ diff --git a/runtime_file.c b/runtime_file.c index a3fff4d1a2..327cca826e 100644 --- a/runtime_file.c +++ b/runtime_file.c @@ -577,6 +577,7 @@ void runtime_log_get_runtime_str(runtime_log_t *runtime_log, if ((n < 0) || (n >= 64)) n = 0; /* Silence GCC warnings... */ + (void)n; } /* Gets last played entry values */ @@ -831,6 +832,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.day, runtime_log->last_played.hour, runtime_log->last_played.minute); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_YMD: switch (date_separator) @@ -851,6 +853,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.year, runtime_log->last_played.month, runtime_log->last_played.day); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_YM: switch (date_separator) @@ -870,6 +873,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), runtime_log->last_played.year, runtime_log->last_played.month); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_MDYYYY_HMS: switch (date_separator) @@ -893,6 +897,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.hour, runtime_log->last_played.minute, runtime_log->last_played.second); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_MDYYYY_HM: switch (date_separator) @@ -915,6 +920,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.year, runtime_log->last_played.hour, runtime_log->last_played.minute); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_MD_HM: switch (date_separator) @@ -936,6 +942,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.day, runtime_log->last_played.hour, runtime_log->last_played.minute); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_MDYYYY: switch (date_separator) @@ -956,6 +963,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.month, runtime_log->last_played.day, runtime_log->last_played.year); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_MD: switch (date_separator) @@ -975,6 +983,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), runtime_log->last_played.month, runtime_log->last_played.day); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_DDMMYYYY_HMS: switch (date_separator) @@ -998,6 +1007,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.hour, runtime_log->last_played.minute, runtime_log->last_played.second); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_DDMMYYYY_HM: switch (date_separator) @@ -1020,6 +1030,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.year, runtime_log->last_played.hour, runtime_log->last_played.minute); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_DDMM_HM: switch (date_separator) @@ -1041,6 +1052,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.month, runtime_log->last_played.hour, runtime_log->last_played.minute); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_DDMMYYYY: switch (date_separator) @@ -1061,6 +1073,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.day, runtime_log->last_played.month, runtime_log->last_played.year); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_DDMM: switch (date_separator) @@ -1079,6 +1092,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, msg_hash_to_str( MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), runtime_log->last_played.day, runtime_log->last_played.month); + (void)n; return; case PLAYLIST_LAST_PLAYED_STYLE_YMD_HMS: default: @@ -1103,6 +1117,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, runtime_log->last_played.hour, runtime_log->last_played.minute, runtime_log->last_played.second); + (void)n; return; } } @@ -1116,6 +1131,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log, if ((n < 0) || (n >= 64)) n = 0; /* Silence GCC warnings... */ + (void)n; } /* Status */ @@ -1200,7 +1216,8 @@ void runtime_log_save(runtime_log_t *runtime_log) runtime_log->runtime.seconds); if ((n < 0) || (n >= 64)) n = 0; /* Silence GCC warnings... */ - + (void)n; + rjsonwriter_add_spaces(writer, 2); rjsonwriter_add_string(writer, "runtime"); rjsonwriter_add_colon(writer); @@ -1220,6 +1237,7 @@ void runtime_log_save(runtime_log_t *runtime_log) if ((n < 0) || (n >= 64)) n = 0; /* Silence GCC warnings... */ + (void)n; rjsonwriter_add_spaces(writer, 2); rjsonwriter_add_string(writer, "last_played"); rjsonwriter_add_colon(writer);