[libvirt] [PATCH] configmake: Avoid namespace pollution issue on mingw.
Eric Blake
eblake at redhat.com
Thu Aug 8 13:32:38 UTC 2019
On 8/8/19 8:08 AM, Eric Blake wrote:
> Mingw includes a header that declares a struct typedef named DATADIR,
> pulled in when including <winsock2.h>; compilation fails if DATADIR
> has already been defined as a macro expanding to a string prior to
> that inclusion. Although the configmake module documents that it
> should generally be included only after system headers, it is just as
> easy to make configmake.h robust to this particular issue by including
> the system header first if it exists.
>
> * modules/configmake (Makefile.am): If the project uses
> <winsock2.h>, include that header before defining DATADIR.
> Reported by libvirt:
> https://lists.gnu.org/archive/html/bug-gnulib/2019-07/msg00089.html
> ---
>
> I'm pushing this under the gnulib maintenance rule, while working on
> a further gnulib change to make configmake.h nicer on mingw.
Except I posted the wrong patch (the gnulib patch I'm still working on,
not the actual libvirt patch I pushed). That would be:
From 05fb5f5af29c0169243928a93bbdc48cc0e87e4d Mon Sep 17 00:00:00 2001
From: Eric Blake <eblake at redhat.com>
Date: Thu, 8 Aug 2019 07:16:42 -0500
Subject: [PATCH] maint: Update to latest gnulib
Requires adjustments to use verify_expr() which replaces
verify_true(), and to disable the new syntax check
'sc_prohibit_gnu_make_extensions' since we require GNU make.
Signed-off-by: Eric Blake <eblake at redhat.com>
---
src/util/viratomic.h | 18 +++++++++---------
.gnulib | 2 +-
cfg.mk | 1 +
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/util/viratomic.h b/src/util/viratomic.h
index 35800dafcd..9dfb77b992 100644
--- a/src/util/viratomic.h
+++ b/src/util/viratomic.h
@@ -157,58 +157,58 @@ VIR_STATIC unsigned int virAtomicIntXor(volatile
unsigned int *atomic,
# define virAtomicIntGet(atomic) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
__sync_synchronize(); \
(int)*(atomic); \
}))
# define virAtomicIntSet(atomic, newval) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void)(0 ? *(atomic) ^ (newval) : 0); \
*(atomic) = (newval); \
__sync_synchronize(); \
}))
# define virAtomicIntInc(atomic) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
__sync_add_and_fetch((atomic), 1); \
}))
# define virAtomicIntDecAndTest(atomic) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void)(0 ? *(atomic) ^ *(atomic) : 0); \
__sync_fetch_and_sub((atomic), 1) == 1; \
}))
# define virAtomicIntCompareExchange(atomic, oldval, newval) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void)(0 ? *(atomic) ^ (newval) ^ (oldval) : 0); \
(bool)__sync_bool_compare_and_swap((atomic), \
(oldval), (newval)); \
}))
# define virAtomicIntAdd(atomic, val) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void)(0 ? *(atomic) ^ (val) : 0); \
(int) __sync_fetch_and_add((atomic), (val)); \
}))
# define virAtomicIntAnd(atomic, val) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void) (0 ? *(atomic) ^ (val) : 0); \
(unsigned int) __sync_fetch_and_and((atomic), (val)); \
}))
# define virAtomicIntOr(atomic, val) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void) (0 ? *(atomic) ^ (val) : 0); \
(unsigned int) __sync_fetch_and_or((atomic), (val)); \
}))
# define virAtomicIntXor(atomic, val) \
(__extension__ ({ \
- (void)verify_true(sizeof(*(atomic)) == sizeof(int)); \
+ (void)verify_expr(sizeof(*(atomic)) == sizeof(int), 0); \
(void) (0 ? *(atomic) ^ (val) : 0); \
(unsigned int) __sync_fetch_and_xor((atomic), (val)); \
}))
diff --git a/.gnulib b/.gnulib
index 8089c00979..c8e2eee548 160000
--- a/.gnulib
+++ b/.gnulib
@@ -1 +1 @@
-Subproject commit 8089c00979a5b089cff592c6b91420e595657167
+Subproject commit c8e2eee548e6e81f3fccd31cf9f9a825db7fc8a8
diff --git a/cfg.mk b/cfg.mk
index cc1f79a051..85b5a0a5a2 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -59,6 +59,7 @@ local-checks-to-skip = \
sc_obsolete_symbols \
sc_prohibit_S_IS_definition \
sc_prohibit_atoi_atof \
+ sc_prohibit_gnu_make_extensions \
sc_prohibit_hash_without_use \
sc_prohibit_jm_in_m4 \
sc_prohibit_quote_without_use \
--
2.20.1
--
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/20190808/f8a1d695/attachment-0001.sig>
More information about the libvir-list
mailing list