treewide: Add CODE_UNREACHABLE after k_thread_abort(current)

Compiler can't tell that k_thread_abort() won't return and issues a
warning unless we tell it that control never gets this far.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2023-10-19 16:06:28 -07:00 committed by Carles Cufí
parent 7ec0be76ae
commit 564adad952
8 changed files with 15 additions and 0 deletions

View file

@ -628,6 +628,8 @@ void pthread_exit(void *retval)
/* not a valid posix_thread */
LOG_DBG("Aborting non-pthread %p", k_current_get());
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
}
/* Make a thread as cancelable before exiting */

View file

@ -149,6 +149,8 @@ void inferenceProcessTask(void *_name, void *heap, void *_params)
}
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
}
/* inferenceSenderTask - Creates NUM_INFERENCE_JOBS jobs, queues them, and then

View file

@ -1307,6 +1307,8 @@ static void kill_handler(const struct shell *sh)
sh->ctx->tid = NULL;
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
}
void shell_thread(void *shell_handle, void *arg_log_backend,

View file

@ -440,6 +440,8 @@ static void test_finalize(void)
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
k_thread_abort(&ztest_thread);
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
}
}

View file

@ -106,6 +106,8 @@ static inline void z_vrfy_ztest_set_assert_valid(bool valid)
__weak void ztest_post_assert_fail_hook(void)
{
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
}
#ifdef CONFIG_ASSERT_NO_FILE_INFO

View file

@ -440,6 +440,8 @@ static void test_finalize(void)
if (IS_ENABLED(CONFIG_MULTITHREADING)) {
k_thread_abort(&ztest_thread);
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
}
}

View file

@ -125,6 +125,8 @@ void yield_worker(void *p1, void *p2, void *p3)
zassert_true(n_exec == NUM_THREADS, "");
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
}
ZTEST(suite_deadline, test_yield)

View file

@ -25,6 +25,7 @@ static void thread_entry_abort(void *p1, void *p2, void *p3)
/**TESTPOINT: abort current thread*/
execute_flag = 1;
k_thread_abort(k_current_get());
CODE_UNREACHABLE;
/*unreachable*/
execute_flag = 2;
zassert_true(1 == 0);