Removing gnu99 constructs from elfutils

Mark Wielaard mark@klomp.org
Fri Nov 13 12:38:55 GMT 2020


Hi Timm,

On Thu, 2020-11-12 at 16:03 +0100, Timm Bäder via Elfutils-devel wrote:
> I'm looking into removing both the nested functions as well as
> variable-length arrays in the elfutils source code, so it can be
> built
> using clang. This is a continuation of
> https://sourceware.org/bugzilla/show_bug.cgi?id=24964 basically.

OK. The mail subject is a little misleading, this is far from turning
the code base into ISO C99. gnu99 is much more than those two features:
https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html

Personally I think it would be nicer if compilers that claim to support
gnu99 implemented them all instead of just cherry-picking some. And the
usage of these particular features does make the code simpler/nicer
(IMHO).

> I did try to incorporate some cleanup commits as well so the result does
> not get too ugly. Some of the nested functions have quite a few hidden
> dependencies on the surrounding code.
> 
> I started with libdwfl/dwfl_segment_report_module.c but am planning on
> converting everything else as well of course.
> 
> What do you think?

See above for what I really think :)

That said, I spot checked some of the patches and they actually look
nice enough. My fear was that this would create various global
functions with dozens of arguments, but it seems you avoided that in
most cases.

Thanks for splitting this up into easily reviewable patches. I'll go
over them next week. I haven't immediately seen anything objectionable,
so I think your approach is good.

Maybe you can work together with Navin to untangle his large patch in a
similar way.

Thanks,

Mark


More information about the Elfutils-devel mailing list