Clang-Tidy fixes (#6725)

This commit is contained in:
Pierre Wendling
2022-12-01 16:07:03 -05:00
committed by GitHub
parent c2ce44bead
commit 3c501b963d
184 changed files with 1312 additions and 1154 deletions

View File

@@ -74,7 +74,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]);
}
@@ -196,7 +196,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]);
}
@@ -227,17 +227,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);
@@ -260,8 +260,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) {