Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Dec 2011 04:30:26 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, brooks@FreeBSD.org, David Chisnall <theraven@FreeBSD.org>, src-committers@FreeBSD.org
Subject:   Re: svn commit: r228322 - in head: include lib/libc/stdlib sys/sys
Message-ID:  <20111208041138.Q2451@besplex.bde.org>
In-Reply-To: <20111207155309.GH50300@deviant.kiev.zoral.com.ua>
References:  <201112071525.pB7FPmkH044896@svn.freebsd.org> <20111207155309.GH50300@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111208041138.Q2451>