[libvirt] [PATCH] atomic: mark header functions static

Daniel P. Berrange berrange at redhat.com
Wed Aug 22 07:59:46 UTC 2012


On Tue, Aug 21, 2012 at 01:55:33PM -0600, Eric Blake wrote:
> When gcc atomic intrinsics are not available (such as on RHEL 5
> with gcc 4.1.2), we were getting link errors due to multiple
> definitions:
> 
> ./.libs/libvirt_util.a(libvirt_util_la-virobject.o): In function `virAtomicIntXor':
> /home/dummy/l,ibvirt/src/util/viratomoic.h:404: multiple definition of `virAtomicIntXor'
> ./.libs/libvirt_util.a(libvirt_util_la-viratomic.o):/home/dummy/libvirt/src/util/viratomic.h:404: first defined here
> 
> Solve this by conditionally marking the functions static (the
> condition avoids falling foul of gcc warnings about unused
> static function declarations).
> 
> * src/util/viratomic.h: When not using gcc intrinsics, use static
> functions to avoid linker errors on duplicate functions.
> ---
> 
> Pushing under the build-breaker rule.  Tested on both RHEL 5
> and modern gcc of F17.
> 
> Oh, and I just noticed my indentation is off, while preparing
> this email; I'll squash in the whitespace fix before pushing.
> 
>  src/util/viratomic.h | 75 ++++++++++++++++++++++++++++------------------------
>  1 file changed, 41 insertions(+), 34 deletions(-)


ACK, this looks good to me.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list