[PATCH] [portability] avoid nested functions

Mike Frysinger vapier at gentoo.org
Sun Sep 29 03:12:46 UTC 2013


On Friday 20 September 2013 13:36:03 Josh Stone wrote:
> 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:

odd, that's not the version i added to Gentoo.  must have forgot to squash the 
return fix into this one.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.fedorahosted.org/pipermail/elfutils-devel/attachments/20130928/72e07efd/attachment.sig>


More information about the elfutils-devel mailing list