Clang-Tidy fixes (#6725)

(cherry picked from commit 3c501b963d)
This commit is contained in:
Pierre Wendling
2022-12-01 16:07:03 -05:00
committed by Sam Lantinga
parent e29c0661cc
commit d0bbfdbfb8
179 changed files with 1260 additions and 1101 deletions

View File

@@ -76,7 +76,7 @@ TestRealWorld(int init_sem)
/* Create all the threads */
for (i = 0; i < NUM_THREADS; ++i) {
char name[64];
SDL_snprintf(name, sizeof(name), "Thread%u", (unsigned int)i);
(void)SDL_snprintf(name, sizeof name, "Thread%u", (unsigned int)i);
thread_states[i].number = i;
thread_states[i].thread = SDL_CreateThread(ThreadFuncRealWorld, name, (void *)&thread_states[i]);
}
@@ -198,7 +198,7 @@ TestOverheadContended(SDL_bool try_wait)
/* Create multiple threads to starve the semaphore and cause contention */
for (i = 0; i < NUM_THREADS; ++i) {
char name[64];
SDL_snprintf(name, sizeof(name), "Thread%u", (unsigned int)i);
(void)SDL_snprintf(name, sizeof name, "Thread%u", (unsigned int)i);
thread_states[i].flag = try_wait;
thread_states[i].thread = SDL_CreateThread(ThreadFuncOverheadContended, name, (void *)&thread_states[i]);
}
@@ -229,17 +229,17 @@ TestOverheadContended(SDL_bool try_wait)
duration, try_wait ? "where contended" : "timed out", content_count,
loop_count, ((float)content_count * 100) / loop_count);
/* Print how many semaphores where consumed per thread */
SDL_snprintf(textBuffer, sizeof(textBuffer), "{ ");
(void)SDL_snprintf(textBuffer, sizeof textBuffer, "{ ");
for (i = 0; i < NUM_THREADS; ++i) {
if (i > 0) {
len = SDL_strlen(textBuffer);
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, ", ");
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, ", ");
}
len = SDL_strlen(textBuffer);
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, "%d", thread_states[i].loop_count - thread_states[i].content_count);
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, "%d", thread_states[i].loop_count - thread_states[i].content_count);
}
len = SDL_strlen(textBuffer);
SDL_snprintf(textBuffer + len, sizeof(textBuffer) - len, " }\n");
(void)SDL_snprintf(textBuffer + len, sizeof textBuffer - len, " }\n");
SDL_Log("%s\n", textBuffer);
SDL_DestroySemaphore(sem);
@@ -262,8 +262,8 @@ int main(int argc, char **argv)
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
return 1;
}
signal(SIGTERM, killed);
signal(SIGINT, killed);
(void)signal(SIGTERM, killed);
(void)signal(SIGINT, killed);
init_sem = SDL_atoi(argv[1]);
if (init_sem > 0) {