Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

sd_nvic_SystemReset causes a warning

Hello

NRF52840. SDK5 17.0.2

the function sd_nvic_SystemReset is define like this:

__STATIC_INLINE uint32_t sd_nvic_SystemReset(void)
{
  NVIC_SystemReset();
  return NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN;
}

but NVIC_SystemReset is declared as NO_RETURN which cause dozens of  "statement is unreachable" warnings because this file is included many times.

Is there a way to get rid of this warning for this particular occurence?

what's the good reason for this?

Thanks

Julien

  • Hi,

    What warnings you get depend on the compiler, how the compiler is configured, and what flags you provide the compiler when compiling. For some toolchains this means you get warnings because of that line, and for other toolchains you do not.

    You can disable the warning for this line, but the method depends on toolchain. What toolchain / compiler are you using?

    Note that since sd_nvic_SystemReset() has a return value, it is not an option to not return a value from that function. I do not know why it actually does have a return value, but the idea would be to have a way to signal that something is wrong. It may have made more sense in an earlier version of the SDK.

    Regards,
    Terje

Related