svn commit: r228322 - in head: include lib/libc/stdlib sys/sys

Bruce Evans brde at optusnet.com.au
Wed Dec 7 17:30:29 UTC 2011


On Wed, 7 Dec 2011, Kostik Belousov wrote:

> On Wed, Dec 07, 2011 at 03:25:48PM +0000, David Chisnall wrote:
>> Log:
>>   Implement quick_exit() / at_quick_exit() from C++11 / C1x.  Also add a
>>   __noreturn macro and modify the other exiting functions to use it.
>> ...
>> +struct quick_exit_handler {
>> +	struct quick_exit_handler *next;
>> +	void (*cleanup)(void);
>> +};
>> +
>> +__attribute((weak))
>> +void _ZSt9terminatev(void);

>> ...

>> +{
>> +	/*
>> +	 * XXX: The C++ spec requires us to call std::terminate if there is an
>> +	 * exception here.
>> +	 */
>> +	for (struct quick_exit_handler *h = handlers ; NULL != h ; h = h->next)
> This fragment violates so many style requirements that I probably fail
> to enumerate them all.
> ...

:-).  And you didn't point the style violations in the __attribute(())
declaration above.  These include
- a hard-coded gccism
- formatting of part of the declaration on a separate line
- spelling __attribute__(()) unusually.

I'm not sure what the weak attribute does by itself.  <sys/cdefs.h>
only defines __weak_reference() and does it less unportably without
using __attribute__().

> The h declaration shall go at the start of function, and not at the for
> statement.

The style rules may be different for C++.  It is hard to know what they
are since we don't have any.  This declaration wouldn't even compile in
C90, and style(9) barely supports that since it is based on K&R C.  The
declaration compiles in C99, but unnecessary use of C99 features is a
style bug (because style(9) gives no examples of it).

> ...

Bruce


More information about the svn-src-all mailing list