kernel: init: exclude unreachable code

LCOV/gcovr doesn't understand what CODE_UNREACHABLE means.
Adding LCOV_EXCL_LINE to the macro definition unfortunately
doesn't work.

Exclude a bit of code which spins endlessly when multi-
threading is disabled that runs after the coverage report
is dumped.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
Andrew Boie 2019-06-11 13:33:32 -07:00 committed by Anas Nashif
commit c5164f328b

View file

@ -411,7 +411,7 @@ static void prepare_multithreading(struct k_thread *dummy_thread)
}
static void switch_to_main_thread(void)
static FUNC_NORETURN void switch_to_main_thread(void)
{
#ifdef CONFIG_ARCH_HAS_CUSTOM_SWAP_TO_MAIN
z_arch_switch_to_main_thread(_main_thread, _main_stack,
@ -425,6 +425,7 @@ static void switch_to_main_thread(void)
*/
z_swap_unlocked();
#endif
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
}
#endif /* CONFIG_MULTITHREADING */
@ -519,9 +520,13 @@ FUNC_NORETURN void z_cstart(void)
#else
bg_thread_main(NULL, NULL, NULL);
/* LCOV_EXCL_START
* We've already dumped coverage data at this point.
*/
irq_lock();
while (true) {
}
/* LCOV_EXCL_STOP */
#endif
/*
@ -530,5 +535,5 @@ FUNC_NORETURN void z_cstart(void)
* far.
*/
CODE_UNREACHABLE;
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
}