svn commit: r268137 - head/sys/sys

Bruce Evans brde at optusnet.com.au
Sun Jun 21 15:42:00 UTC 2015


On Sun, 21 Jun 2015, Pedro Giffuni wrote:

> On 06/21/15 01:09, Bruce Evans wrote:
>> On Sat, 20 Jun 2015, Pedro Giffuni wrote:
>* ...
>>> With the patch we would use:
>>> 
>>> __Noreturn void
>>>   foo(void) _dead2;
>>> 
>>> Which is still ugly but C11-ish.
>> 
>> That asks for the same problems as defining __weak.
>> 
>> Why not just don't use _Noreturn?  It is an unimprovement on the gcc
>> attribute.  The attribute works at the beginning or end, while Noreturn
>> only works at the end.
>
> As I see it, newer (C11) software is likely to use _Noreturn in their
> headers

We can define _Noreturn to support this (but possibly shouldn't).

The newer software many be pure C11.  Then it doesn't need any definition,
and just doesn't compile with non-C11 compilers.

If we defined _Noreturn, it would be to use it in non-C11 software, like
we do in stdlib.h.  This is a fragile compatibility hack so it should
be avoided if possible.  We can easily avoid it in our own headers by
not changing anything.  Just use the old declaration, with __dead2 placed
at the end.  Any reasonable implementation of __attribute__() must be able
to support any new attribute that a new standard might add.

Bruce


More information about the svn-src-head mailing list