[libvirt] RFC: Use __attribute__ ((cleanup) in libvirt ?

Daniel P. Berrange berrange at redhat.com
Tue Jan 10 16:20:37 UTC 2017


On Tue, Jan 10, 2017 at 05:05:21PM +0100, Michal Privoznik wrote:
> On 01/09/2017 05:58 PM, Daniel P. Berrange wrote:
> > <snip/>
> > I'm wondering what people think of making use of this in libvirt ?
> 
> Apart from what have been said (I share the same concerns) I like the
> idea. All the "limitations" - we already have them. You have to
> initialize variables even when using 'goto cleanup'. But with this
> feature we can save few lines of code in a lot of functions. Therefore
> I'm up for it. BTW: do you know when was this introduced? Whether this
> feature is available on all prehistoric^Wstill supported systems like RHEL6.

The docs are non-existant on when this appeared, but I just checked
out gcc 4.1.2 and found plenty of references to attribute cleanup.
This covers RHEL-5 vintage, so it looks fine.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|




More information about the libvir-list mailing list