Trying to build with clang fails due to the use of a small nested function. Change it to a macro instead.
I don't expect this to be merged into the main git tree, but it'd be nice if it could be included in the portability patchset. URL: https://bugs.gentoo.org/451986 Signed-off-by: Mike Frysinger <[email protected]> --- v2 - fix return at end of define libelf/elf_begin.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libelf/elf_begin.c b/libelf/elf_begin.c index b9d5cea..63d4a9d 100644 --- a/libelf/elf_begin.c +++ b/libelf/elf_begin.c @@ -1011,18 +1011,17 @@ elf_begin (fildes, cmd, ref) return NULL; } - Elf *lock_dup_elf () - { - /* We need wrlock to dup an archive. */ - if (ref->kind == ELF_K_AR) - { - rwlock_unlock (ref->lock); - rwlock_wrlock (ref->lock); - } - - /* Duplicate the descriptor. */ - return dup_elf (fildes, cmd, ref); - } +#define lock_dup_elf() \ + ({ \ + /* We need wrlock to dup an archive. */ \ + if (ref->kind == ELF_K_AR) \ + { \ + rwlock_unlock (ref->lock); \ + rwlock_wrlock (ref->lock); \ + } \ + /* Duplicate the descriptor. */ \ + dup_elf (fildes, cmd, ref); \ + }) switch (cmd) { -- 1.8.3.2
