[PATCH] rtems: Improve RTEMS_NO_RETURN attribute

Joel Sherrill joel at rtems.org
Tue Oct 6 13:09:53 UTC 2020


This looks OK. Push it.

On Tue, Oct 6, 2020 at 1:06 AM Sebastian Huber <
sebastian.huber at embedded-brains.de> wrote:

> Provide RTEMS_NO_RETURN also in case RTEMS_DEBUG is defined to prevent
> errors
> like this:
>
> error: no return statement in function returning non-void
> [-Werror=return-type]
>
> Use C11 and C++11 standard means to declare a no-return function.
>
> Close #4122.
> ---
>  cpukit/include/rtems/score/basedefs.h | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/cpukit/include/rtems/score/basedefs.h
> b/cpukit/include/rtems/score/basedefs.h
> index c31b4ebef7..0244af1471 100644
> --- a/cpukit/include/rtems/score/basedefs.h
> +++ b/cpukit/include/rtems/score/basedefs.h
> @@ -94,9 +94,11 @@
>   *  can impact the code generated following calls to
>   *  rtems_fatal_error_occurred and _Terminate.
>   */
> -#if defined(RTEMS_SCHEDSIM)
> -  #define RTEMS_NO_RETURN
> -#elif defined(__GNUC__) && !defined(RTEMS_DEBUG)
> +#if __cplusplus >= 201103L
> +  #define RTEMS_NO_RETURN [[noreturn]]
> +#elif __STDC_VERSION__ >= 201112L
> +  #define RTEMS_NO_RETURN _Noreturn
> +#elif defined(__GNUC__)
>    #define RTEMS_NO_RETURN __attribute__((__noreturn__))
>  #else
>    #define RTEMS_NO_RETURN
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20201006/7539bd5e/attachment.html>


More information about the devel mailing list