[libvirt] [PATCH] build: Solve mingw build clash with DATADIR

Eric Blake eblake at redhat.com
Wed Aug 7 14:19:23 UTC 2019


On 7/31/19 2:30 PM, Eric Blake wrote:
> Commit fed58d83 was a hack to fix a mingw build failure due to header
> inclusion order resulting in a clash over the use of DATADIR, by
> repeating a trick made several other times in the past of tweaking
> inclusion order until it goes away.  Better is to revert that, and
> instead use pragmas to avoid the clash in the first place, regardless
> of header ordering, solving it for everyone in the future.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
> 
> I tested that both gcc and clang on F29 support this; but it will take
> a full CI run to see if everywhere else is okay with it. Thus, it is
> not 5.6 material.

Ping now that we are in 5.7

> 
>  src/util/viratomic.h       | 3 +++
>  src/conf/checkpoint_conf.c | 2 --
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/util/viratomic.h b/src/util/viratomic.h
> index 35800dafcd..c6e7668324 100644
> --- a/src/util/viratomic.h
> +++ b/src/util/viratomic.h
> @@ -218,7 +218,10 @@ VIR_STATIC unsigned int virAtomicIntXor(volatile unsigned int *atomic,
> 
>  # ifdef VIR_ATOMIC_OPS_WIN32
> 
> +#  pragma push_macro("DATADIR") /* If "configmake.h" was included first */
> +#  undef DATADIR
>  #  include <winsock2.h>
> +#  pragma pop_macro("DATADIR")
>  #  include <windows.h>
>  #  include <intrin.h>
>  #  if !defined(_M_AMD64) && !defined (_M_IA64) && !defined(_M_X64)
> diff --git a/src/conf/checkpoint_conf.c b/src/conf/checkpoint_conf.c
> index 5ce4cc4853..5f4c275dd8 100644
> --- a/src/conf/checkpoint_conf.c
> +++ b/src/conf/checkpoint_conf.c
> @@ -21,8 +21,6 @@
> 
>  #include <config.h>
> 
> -#include <unistd.h>
> -
>  #include "configmake.h"
>  #include "internal.h"
>  #include "virbitmap.h"
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20190807/83fc1256/attachment-0001.sig>


More information about the libvir-list mailing list