On 09/19/2013 12:38 PM, Mike Frysinger wrote:
+#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. */ \
+ return dup_elf (fildes, cmd, ref); \
+ })
Careful - the nested function just returned from itself, whereas your
macro will try to return from everything. But this doesn't compile
anyway, because a return leaves the stmt-expr with a void value:
../../libelf/elf_begin.c: In function ‘elf_begin’:
../../libelf/elf_begin.c:1046:9: error: void value not ignored as it
ought to be
retval = lock_dup_elf ();
^
../../libelf/elf_begin.c:1067:13: error: void value not ignored as it
ought to be
retval = lock_dup_elf ();
^
Just remove the "return", then the dup_elf(...) as the last statement
will become the value of the stmt-expr.