Skip to content
Permalink
Browse files

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>
  • Loading branch information...
andrewboie authored and nashif committed Jun 11, 2019
1 parent 8e05333 commit c5164f328b3a22084b224cda01e7e5e2b6cd3c6a
Showing with 7 additions and 2 deletions.
  1. +7 −2 kernel/init.c
@@ -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 */
}

0 comments on commit c5164f3

Please sign in to comment.
You can’t perform that action at this time.