This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH] For clang use Blocks instead of nested functions.
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Fri, 11 Sep 2015 14:56:13 +0200
- Subject: Re: [PATCH] For clang use Blocks instead of nested functions.
On Fri, 2015-09-11 at 13:08 +0200, Petr Machata wrote:
> Having a custom syntax to bridge the differences between LLVM and GCC
> seems over the top. It introduces a layer of indirection that is not
> familiar to C coders, and the usage mode is not immediately obvious
> (viz the __BLOCK annotations). It's also fragile--people will forget
> how to use this and that it's supposed to be used at all, so __BLOCK
> annotations and variable ordering will go out of sync with
I agree. I should have said something earlier. But wanted to sleep on it
a bit before shooting the idea down. Nobody wants to be the bad guy.
Sorry for not speaking up earlier.
The proposed replacement is clever, but too verbose and has too
many/duplicate annotations that have to be kept in sync by hand. That
really destroys the whole reason why we use nested functions in the
We use nested functions as a simpler, more (type) safe, way of using
macros. With the added benefit that they can just use the locally
lexical scoped variables. So you don't need to mark them all up or pass
them all through to some static function. It really makes the code much
Any proposed replacement should really not make the code much more
cluttered/verbose. It wouldn't be bad if there is a little preprocessor
magic used (see for example INTUSE/DEF/DECL). But it shouldn't require
so much magic that it will be hard to read and maintain/keep up to date
when changing the code.