[PATCH] rtems: Improve RTEMS_NO_RETURN attribute

Joel Sherrill joel at rtems.org
Tue Oct 6 15:55:28 UTC 2020


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

> On 06/10/2020 17:34, Joel Sherrill wrote:
>
> >
> > On Tue, Oct 6, 2020 at 9:46 AM Sebastian Huber
> > <sebastian.huber at embedded-brains.de
> > <mailto:sebastian.huber at embedded-brains.de>> wrote:
> >
> >     On 06/10/2020 16:37, Joel Sherrill wrote:
> >
> >     > How does it break the API? It looks like a change of annotation.
> >     > Shouldn't be a big deal unless I am misunderstanding something.
> >
> >     Please have a look at:
> >
> >     https://lists.rtems.org/pipermail/devel/2020-October/062577.html
> >
> >
> > Looks like basically the same code. What does this break? Why the
> concern?
>
> The C11/C++11 attribute syntax is less flexible compared to the GNU
> attributes. For example:
>
> echo "_Noreturn void ok(void);" > test.c
>
> echo "void error(void) _Noreturn;" >> test.c
>
> gcc test.c
>
> test.c: In function ‘error’:
> test.c:2:1: error: ‘_Noreturn’ in empty declaration
>   void error(void) _Noreturn;
>   ^~~~
> test.c:2:18: warning: empty declaration
>   void error(void) _Noreturn;
>                    ^~~~~~~~~
> test.c:2:1: error: expected ‘{’ at end of input
>   void error(void) _Noreturn;
>   ^~~~
>
>
Yuck. I can see why they did the placement kind of. Makes it like const
or static but it uses an odd keyword with leading _ and capital letter
which is rather insane.

What's the positive value for doing this? Does llvm or some static
analyser like it better?

C11 has improvements but it also has more than one thing I
question if they really thought through. :(

--joel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20201006/50100748/attachment.html>


More information about the devel mailing list