Unify the void cast usage

1.Remove void cast for function because many place ignore the returned value witout cast
2.Replace void cast for variable with UNUSED macro

Change-Id: Ie644129a563244a6397036789c4c3ea83c4e9b09
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2020-01-02 20:09:50 +08:00
parent 73e1696e8b
commit 857158451b
263 changed files with 1038 additions and 1047 deletions

View file

@ -153,7 +153,7 @@ static void fstest_loopmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
/* Show the change from the previous loop */
@ -179,7 +179,7 @@ static void fstest_endmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
printf("\nFinal memory usage:\n");
fstest_showmemusage(&g_mmbefore, &g_mmafter);
@ -967,7 +967,7 @@ int main(int argc, FAR char *argv[])
g_mmbefore = mallinfo();
g_mmprevious = g_mmbefore;
#else
(void)mallinfo(&g_mmbefore);
mallinfo(&g_mmbefore);
memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo));
#endif
@ -988,7 +988,7 @@ int main(int argc, FAR char *argv[])
*/
printf("\n=== FILLING %u =============================\n", i);
(void)fstest_fillfs();
fstest_fillfs();
printf("Filled file system\n");
printf(" Number of files: %d\n", g_nfiles);
printf(" Number deleted: %d\n", g_ndeleted);
@ -1084,7 +1084,7 @@ int main(int argc, FAR char *argv[])
/* Perform garbage collection, integrity checks */
(void)fstest_gc(buf.f_bfree);
fstest_gc(buf.f_bfree);
/* Show memory usage */

View file

@ -184,7 +184,7 @@ static void nxffs_loopmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
/* Show the change from the previous loop */
@ -210,7 +210,7 @@ static void nxffs_endmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
printf("\nFinal memory usage:\n");
nxffs_showmemusage(&g_mmbefore, &g_mmafter);
@ -833,7 +833,7 @@ int main(int argc, FAR char *argv[])
g_mmbefore = mallinfo();
g_mmprevious = g_mmbefore;
#else
(void)mallinfo(&g_mmbefore);
mallinfo(&g_mmbefore);
memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo));
#endif
@ -854,7 +854,7 @@ int main(int argc, FAR char *argv[])
*/
printf("\n=== FILLING %u =============================\n", i);
(void)nxffs_fillfs();
nxffs_fillfs();
printf("Filled file system\n");
printf(" Number of files: %d\n", g_nfiles);
printf(" Number deleted: %d\n", g_ndeleted);

View file

@ -304,7 +304,7 @@ void aio_test(void)
sigfillset(&set);
sigdelset(&set, SIGUSR1);
sigdelset(&set, SIGALRM);
(void)sigprocmask(SIG_SETMASK, &set, &oset);
sigprocmask(SIG_SETMASK, &set, &oset);
/* Case 1: Poll for transfer complete */
@ -627,7 +627,7 @@ void aio_test(void)
}
while (ret < 0);
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
sigprocmask(SIG_SETMASK, &oset, NULL);
printf("aio_test: Test completed successfully\n");
return;
@ -635,7 +635,7 @@ errout_with_fildes:
close(g_fildes);
g_fildes = -1;
errout_with_procmask:
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
sigprocmask(SIG_SETMASK, &oset, NULL);
printf("aio_test: ERROR: Test aborted\n");
}

View file

@ -138,7 +138,7 @@ void barrier_test(void)
/* Create the barrier */
(void)pthread_barrierattr_init(&barrierattr);
pthread_barrierattr_init(&barrierattr);
/* Start CONFIG_TESTING_OSTEST_NBARRIER_THREADS thread instances */

View file

@ -336,8 +336,8 @@ void fpu_test(void)
/* Wait for each task to complete */
fflush(stdout);
(void)waitpid(task1, &statloc, 0);
(void)waitpid(task2, &statloc, 0);
waitpid(task1, &statloc, 0);
waitpid(task2, &statloc, 0);
#else
printf("fpu_test: ERROR: The FPU test is not properly configured\n");

View file

@ -130,7 +130,7 @@ void mutex_test(void)
printf("Starting thread 1\n");
#ifdef SDCC
(void)pthread_attr_init(&attr);
pthread_attr_init(&attr);
status = pthread_create(&thread1, &attr, thread_func, (pthread_addr_t)1);
#else
status = pthread_create(&thread1, NULL, thread_func, (pthread_addr_t)1);

View file

@ -142,7 +142,7 @@ static void check_test_memory_usage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
/* Show the change from the previous time */
@ -228,7 +228,7 @@ static int user_main(int argc, char *argv[])
g_mmbefore = mallinfo();
g_mmprevious = g_mmbefore;
#else
(void)mallinfo(&g_mmbefore);
mallinfo(&g_mmbefore);
memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo));
#endif
@ -556,7 +556,7 @@ static int user_main(int argc, char *argv[])
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
printf("\nFinal memory usage:\n");

View file

@ -118,7 +118,7 @@ static void timer_expiration(int signo, siginfo_t *info, void *ucontext)
/* Check sigprocmask */
(void)sigfillset(&allsigs);
sigfillset(&allsigs);
status = sigprocmask(SIG_SETMASK, NULL, &oldset);
if (status != OK)
{
@ -156,8 +156,8 @@ void timer_test(void)
printf("timer_test: Unmasking signal %d\n" , MY_TIMER_SIGNAL);
(void)sigemptyset(&set);
(void)sigaddset(&set, MY_TIMER_SIGNAL);
sigemptyset(&set);
sigaddset(&set, MY_TIMER_SIGNAL);
status = sigprocmask(SIG_UNBLOCK, &set, NULL);
if (status != OK)
{
@ -169,8 +169,8 @@ void timer_test(void)
act.sa_sigaction = timer_expiration;
act.sa_flags = SA_SIGINFO;
(void)sigfillset(&act.sa_mask);
(void)sigdelset(&act.sa_mask, MY_TIMER_SIGNAL);
sigfillset(&act.sa_mask);
sigdelset(&act.sa_mask, MY_TIMER_SIGNAL);
status = sigaction(MY_TIMER_SIGNAL, &act, &oact);
if (status != OK)

View file

@ -552,20 +552,20 @@ void priority_inheritance(void)
{
printf("priority_inheritance: Waiting for highpri_thread-%d to complete\n", i+1);
FFLUSH();
(void)pthread_join(highpri[i], &result);
pthread_join(highpri[i], &result);
dump_nfreeholders("priority_inheritance:");
}
printf("priority_inheritance: Waiting for medpri_thread to complete\n");
FFLUSH();
(void)pthread_join(medpri, &result);
pthread_join(medpri, &result);
dump_nfreeholders("priority_inheritance:");
for (i = 0; i < NLOWPRI_THREADS; i++)
{
printf("priority_inheritance: Waiting for lowpri_thread-%d to complete\n", i+1);
FFLUSH();
(void)pthread_join(lowpri[i], &result);
pthread_join(lowpri[i], &result);
dump_nfreeholders("priority_inheritance:");
}

View file

@ -268,8 +268,8 @@ static void test_two_threads(void)
g_race_cond_thread_pos = 0;
status = pthread_create(&thread1, NULL, race_cond_thread1, &rc);
status = pthread_create(&thread2, NULL, race_cond_thread2, &rc);
(void) pthread_join(thread1, NULL);
(void) pthread_join(thread2, NULL);
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
}
static void * timeout_thread1(FAR void * data)
@ -373,8 +373,8 @@ static void test_timeout(void)
status = pthread_create(&thread1, NULL, timeout_thread1, &rc);
status = pthread_create(&thread2, NULL, timeout_thread2, &rc);
(void) pthread_join(thread1, NULL);
(void) pthread_join(thread2, NULL);
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
}
/****************************************************************************

View file

@ -63,7 +63,7 @@ static void * timeout_thread1(FAR void * data)
while(1)
{
(void)clock_gettime(CLOCK_REALTIME, &time);
clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += 1;
status = pthread_rwlock_timedrdlock(sync->write_lock, &time);
@ -84,7 +84,7 @@ static void * timeout_thread2(FAR void * data)
while (1)
{
(void)clock_gettime(CLOCK_REALTIME, &time);
clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += 1;
status = pthread_rwlock_timedrdlock(sync->read_lock, &time);
@ -104,7 +104,7 @@ static void * timeout_thread2(FAR void * data)
}
}
(void)clock_gettime(CLOCK_REALTIME, &time);
clock_gettime(CLOCK_REALTIME, &time);
time.tv_sec += 1;
status = pthread_rwlock_timedwrlock(sync->read_lock, &time);
@ -186,8 +186,8 @@ static void test_timeout(void)
printf("pthread_rwlock_cancel: ERROR pthread_cancel, status=%d\n", status);
}
(void) pthread_join(thread1, NULL);
(void) pthread_join(thread2, NULL);
pthread_join(thread1, NULL);
pthread_join(thread2, NULL);
/* Do some operations on locks in order to check if they are still in
* usable state after deferred cancellation. */

View file

@ -161,7 +161,7 @@ void recursive_mutex_test(void)
{
printf("recursive_mutex_test: Starting thread %d\n", i+1);
#ifdef SDCC
(void)pthread_attr_init(&attr);
pthread_attr_init(&attr);
status = pthread_create(&thread[i], &attr, thread_outer, (pthread_addr_t)((uintptr_t)i+1));
#else
status = pthread_create(&thread[i], NULL, thread_outer, (pthread_addr_t)((uintptr_t)i+1));

View file

@ -136,7 +136,7 @@ static void wakeup_action(int signo, siginfo_t *info, void *ucontext)
/* Check sigprocmask */
(void)sigfillset(&allsigs);
sigfillset(&allsigs);
status = sigprocmask(SIG_SETMASK, NULL, &oldset);
if (status != OK)
{
@ -161,8 +161,8 @@ static int waiter_main(int argc, char *argv[])
printf("waiter_main: Waiter started\n" );
printf("waiter_main: Unmasking signal %d\n" , WAKEUP_SIGNAL);
(void)sigemptyset(&set);
(void)sigaddset(&set, WAKEUP_SIGNAL);
sigemptyset(&set);
sigaddset(&set, WAKEUP_SIGNAL);
status = sigprocmask(SIG_UNBLOCK, &set, NULL);
if (status != OK)
{
@ -174,8 +174,8 @@ static int waiter_main(int argc, char *argv[])
act.sa_sigaction = wakeup_action;
act.sa_flags = SA_SIGINFO;
(void)sigfillset(&act.sa_mask);
(void)sigdelset(&act.sa_mask, WAKEUP_SIGNAL);
sigfillset(&act.sa_mask);
sigdelset(&act.sa_mask, WAKEUP_SIGNAL);
status = sigaction(WAKEUP_SIGNAL, &act, &oact);
if (status != OK)
@ -214,7 +214,7 @@ static int waiter_main(int argc, char *argv[])
/* Detach the signal handler */
act.sa_handler = SIG_DFL;
(void)sigaction(WAKEUP_SIGNAL, &act, &oact);
sigaction(WAKEUP_SIGNAL, &act, &oact);
printf("waiter_main: done\n" );
FFLUSH();
@ -245,8 +245,8 @@ void sighand_test(void)
#ifdef CONFIG_SCHED_HAVE_PARENT
printf("sighand_test: Unmasking SIGCHLD\n");
(void)sigemptyset(&set);
(void)sigaddset(&set, SIGCHLD);
sigemptyset(&set);
sigaddset(&set, SIGCHLD);
status = sigprocmask(SIG_UNBLOCK, &set, NULL);
if (status != OK)
{
@ -258,8 +258,8 @@ void sighand_test(void)
act.sa_sigaction = death_of_child;
act.sa_flags = SA_SIGINFO;
(void)sigfillset(&act.sa_mask);
(void)sigdelset(&act.sa_mask, SIGCHLD);
sigfillset(&act.sa_mask);
sigdelset(&act.sa_mask, SIGCHLD);
status = sigaction(SIGCHLD, &act, &oact);
if (status != OK)
@ -332,7 +332,7 @@ void sighand_test(void)
#ifdef CONFIG_SCHED_HAVE_PARENT
act.sa_handler = SIG_DFL;
(void)sigaction(SIGCHLD, &act, &oact);
sigaction(SIGCHLD, &act, &oact);
#endif
printf("sighand_test: done\n" );

View file

@ -134,7 +134,7 @@ static int waiter_main(int argc, char *argv[])
printf("waiter_main: Waiter started\n" );
printf("waiter_main: Setting signal mask\n" );
(void)sigemptyset(&set);
sigemptyset(&set);
ret = sigprocmask(SIG_SETMASK, &set, NULL);
if (ret < 0)
{
@ -147,12 +147,12 @@ static int waiter_main(int argc, char *argv[])
act.sa_handler = waiter_action;
act.sa_flags = 0;
(void)sigemptyset(&act.sa_mask);
sigemptyset(&act.sa_mask);
for (i = 1; i < MAX_SIGNO; i += 2)
{
if (signest_catchable(i))
{
(void)sigaddset(&act.sa_mask, i);
sigaddset(&act.sa_mask, i);
}
}
@ -196,7 +196,7 @@ static int interfere_main(int argc, char *argv[])
g_interferer_running = true;
while (!g_done)
{
(void)sem_wait(&g_interferer_sem);
sem_wait(&g_interferer_sem);
}
/* Just exit, the system should clean up the signal handlers */

View file

@ -129,7 +129,7 @@ void specific_test(void)
printf("Starting thread\n");
#ifdef SDCC
(void)pthread_attr_init(&attr);
pthread_attr_init(&attr);
ret = pthread_create(&thread, &attr, thread_func, (pthread_addr_t)0);
#else
ret = pthread_create(&thread, NULL, thread_func, (pthread_addr_t)0);

View file

@ -119,7 +119,7 @@ static void *thread_func(FAR void *parameter)
/* Release the lock and wait a bit in case the main thread wants it. */
(void)pthread_mutex_unlock(&g_mutex);
pthread_mutex_unlock(&g_mutex);
usleep(500*1000);
}
@ -157,7 +157,7 @@ void timedmutex_test(void)
printf("mutex_test: Starting thread\n");
#ifdef SDCC
(void)pthread_attr_init(&attr);
pthread_attr_init(&attr);
status = pthread_create(&thread, &attr, thread_func, (pthread_addr_t)0);
#else
status = pthread_create(&thread, NULL, thread_func, (pthread_addr_t)0);
@ -175,7 +175,7 @@ void timedmutex_test(void)
/* Then unlock the mutex. This should wake up the pthread. */
printf("mutex_test: Unlocking\n");
(void)pthread_mutex_unlock(&g_mutex);
pthread_mutex_unlock(&g_mutex);
/* Wait a bit to assure that the thread gets a chance to lock the mutex at
* least once (it may probably loop and retake the mutex several times)
@ -227,7 +227,7 @@ void timedmutex_test(void)
#endif
errout_with_lock:
(void)pthread_mutex_unlock(&g_mutex);
pthread_mutex_unlock(&g_mutex);
errout_with_mutex:
(void)pthread_mutex_destroy(&g_mutex);
pthread_mutex_destroy(&g_mutex);
}

View file

@ -187,7 +187,7 @@ static void smart_loopmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
/* Show the change from the previous loop */
@ -213,7 +213,7 @@ static void smart_endmemusage(void)
#ifdef CONFIG_CAN_PASS_STRUCTS
g_mmafter = mallinfo();
#else
(void)mallinfo(&g_mmafter);
mallinfo(&g_mmafter);
#endif
printf("\nFinal memory usage:\n");
smart_showmemusage(&g_mmbefore, &g_mmafter);
@ -829,9 +829,9 @@ int main(int argc, FAR char *argv[])
/* Create a SMARTFS filesystem */
#ifdef CONFIG_SMARTFS_MULTI_ROOT_DIRS
(void)mksmartfs("/dev/smart1", 1024, 1);
mksmartfs("/dev/smart1", 1024, 1);
#else
(void)mksmartfs("/dev/smart1", 1024);
mksmartfs("/dev/smart1", 1024);
#endif
/* Mount the file system */
@ -850,7 +850,7 @@ int main(int argc, FAR char *argv[])
g_mmbefore = mallinfo();
g_mmprevious = g_mmbefore;
#else
(void)mallinfo(&g_mmbefore);
mallinfo(&g_mmbefore);
memcpy(&g_mmprevious, &g_mmbefore, sizeof(struct mallinfo));
#endif
@ -871,7 +871,7 @@ int main(int argc, FAR char *argv[])
*/
printf("\n=== FILLING %u =============================\n", i);
(void)smart_fillfs();
smart_fillfs();
printf("Filled file system\n");
printf(" Number of files: %d\n", g_nfiles);
printf(" Number deleted: %d\n", g_ndeleted);

View file

@ -148,7 +148,7 @@ static void hog_time(FAR const char *caller, int threadno)
/* Let other threads run */
(void)pthread_yield();
pthread_yield();
show_cpu_conditional(caller, threadno);
}
}
@ -265,7 +265,7 @@ int main(int argc, FAR char *argv[])
/* Create the barrier */
(void)pthread_barrierattr_init(&barrierattr);
pthread_barrierattr_init(&barrierattr);
/* Start CONFIG_TESTING_SMP_NBARRIER_THREADS thread instances */