Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jun 2023 13:56:59 GMT
From:      =?utf-8?Q?Roger=20Pau=20Monn=C3=A9?= <royger@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 8d3618a14d48 - main - sys-utils/xen-tools: remove usage of signed bitfields
Message-ID:  <202306281356.35SDuxkK075800@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by royger:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8d3618a14d48e06e7645cbdfac7851a1f1664747

commit 8d3618a14d48e06e7645cbdfac7851a1f1664747
Author:     Roger Pau Monné <royger@FreeBSD.org>
AuthorDate: 2023-06-28 09:12:32 +0000
Commit:     Roger Pau Monné <royger@FreeBSD.org>
CommitDate: 2023-06-28 13:56:06 +0000

    sys-utils/xen-tools: remove usage of signed bitfields
    
    When using a single-bit signed bitfield clang complains with:
    
    xenalyze.c:6157:17: error: implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1
    
    Backport fix from upstream Xen.
    
    Sponsored by: Citrix System R&D
    Approved by: bapt (implicit)
---
 sysutils/xen-tools/Makefile                        |  5 +-
 ...-tools-convert-bitfields-to-unsigned-type.patch | 71 ++++++++++++++++++++++
 2 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/sysutils/xen-tools/Makefile b/sysutils/xen-tools/Makefile
index f6d8b8f8242b..c35ffd1e2b57 100644
--- a/sysutils/xen-tools/Makefile
+++ b/sysutils/xen-tools/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	xen
 PKGNAMESUFFIX=	-tools
 PORTVERSION=	4.17.0
-PORTREVISION=	0
+PORTREVISION=	1
 CATEGORIES=	sysutils emulators
 MASTER_SITES=	http://downloads.xenproject.org/release/xen/${PORTVERSION}/
 
@@ -63,7 +63,8 @@ DOCS_INSTALL_TARGET=	install-docs
 
 # clang build fixes
 EXTRA_PATCHES+=	${PATCHDIR}/0001-xen-x86-Remove-the-use-of-K-R-functions.patch:-p1 \
-		${PATCHDIR}/0001-tools-Remove-the-use-of-K-R-functions.patch:-p1
+		${PATCHDIR}/0001-tools-Remove-the-use-of-K-R-functions.patch:-p1 \
+		${PATCHDIR}/0001-tools-convert-bitfields-to-unsigned-type.patch:-p1
 
 .include <bsd.port.options.mk>
 
diff --git a/sysutils/xen-tools/files/0001-tools-convert-bitfields-to-unsigned-type.patch b/sysutils/xen-tools/files/0001-tools-convert-bitfields-to-unsigned-type.patch
new file mode 100644
index 000000000000..83b11f35d373
--- /dev/null
+++ b/sysutils/xen-tools/files/0001-tools-convert-bitfields-to-unsigned-type.patch
@@ -0,0 +1,71 @@
+From 99ab02f63ea813f2e467a39a7736bf460a3f3495 Mon Sep 17 00:00:00 2001
+From: Olaf Hering <olaf@aepfle.de>
+Date: Mon, 8 May 2023 16:46:18 +0000
+Subject: [PATCH] tools: convert bitfields to unsigned type
+
+clang complains about the signed type:
+
+implicit truncation from 'int' to a one-bit wide bit-field changes value from 1 to -1 [-Wsingle-bit-bitfield-constant-conversion]
+
+The potential ABI change in libxenvchan is covered by the Xen version based SONAME.
+
+Signed-off-by: Olaf Hering <olaf@aepfle.de>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Acked-by: Anthony PERARD <anthony.perard@citrix.com>
+---
+ tools/include/libxenvchan.h | 6 +++---
+ tools/xentrace/xenalyze.c   | 8 ++++----
+ 2 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/tools/include/libxenvchan.h b/tools/include/libxenvchan.h
+index 30cc73cf97e3..3d3b8aa8dd79 100644
+--- a/tools/include/libxenvchan.h
++++ b/tools/include/libxenvchan.h
+@@ -79,11 +79,11 @@ struct libxenvchan {
+ 	xenevtchn_handle *event;
+ 	uint32_t event_port;
+ 	/* informative flags: are we acting as server? */
+-	int is_server:1;
++	unsigned int is_server:1;
+ 	/* true if server remains active when client closes (allows reconnection) */
+-	int server_persist:1;
++	unsigned int server_persist:1;
+ 	/* true if operations should block instead of returning 0 */
+-	int blocking:1;
++	unsigned int blocking:1;
+ 	/* communication rings */
+ 	struct libxenvchan_ring read, write;
+ 	/**
+diff --git a/tools/xentrace/xenalyze.c b/tools/xentrace/xenalyze.c
+index 12dcca964645..a50538e9a8c8 100644
+--- a/tools/xentrace/xenalyze.c
++++ b/tools/xentrace/xenalyze.c
+@@ -1377,7 +1377,7 @@ struct hvm_data {
+     tsc_t exit_tsc, arc_cycles, entry_tsc;
+     unsigned long long rip;
+     unsigned exit_reason, event_handler;
+-    int short_summary_done:1, prealloc_unpin:1, wrmap_bf:1;
++    unsigned int short_summary_done:1, prealloc_unpin:1, wrmap_bf:1;
+ 
+     /* Immediate processing */
+     void *d;
+@@ -8235,13 +8235,13 @@ void mem_set_p2m_entry_process(struct pcpu_info *p)
+ 
+     struct {
+         uint64_t gfn, mfn;
+-        int p2mt;
+-        int d:16,order:16;
++        uint32_t p2mt;
++        uint16_t d, order;
+     } *r = (typeof(r))ri->d;
+ 
+     if ( opt.dump_all )
+     {
+-        printf(" %s set_p2m_entry d%d o%d t %d g %llx m %llx\n",
++        printf(" %s set_p2m_entry d%u o%u t %u g %llx m %llx\n",
+                ri->dump_header,
+                r->d, r->order,
+                r->p2mt,
+-- 
+2.41.0
+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202306281356.35SDuxkK075800>