Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 18 Dec 2025 13:47:38 +0000
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 377e6050c1cb - main - vmem: Fix the gcc build
Message-ID:  <694405fa.33ba7.3a4b0eaf@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=377e6050c1cb9edce90d2a3caa2833fcc09b8c68

commit 377e6050c1cb9edce90d2a3caa2833fcc09b8c68
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2025-12-17 20:54:40 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-12-18 13:47:29 +0000

    vmem: Fix the gcc build
    
    gcc complains when building libuvmem because the last two operands of ?:
    in ORDER2SIZE and SIZE2ORDER have different signs.  Add explicit casts
    to address this.
    
    Reported by:    Jenkins
    Reviewed by:    alc, kib
    MFC after:      1 week
    Fixes:          1ecf01065b45 ("libuvmem: usermode port of vmem(9)")
    Differential Revision:  https://reviews.freebsd.org/D54268
---
 sys/kern/subr_vmem.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sys/kern/subr_vmem.c b/sys/kern/subr_vmem.c
index afc327c512ce..8b834a2e2a79 100644
--- a/sys/kern/subr_vmem.c
+++ b/sys/kern/subr_vmem.c
@@ -285,10 +285,12 @@ static LIST_HEAD(, vmem) vmem_list = LIST_HEAD_INITIALIZER(vmem_list);
 #define	VMEM_CROSS_P(addr1, addr2, boundary) \
 	((((addr1) ^ (addr2)) & -(boundary)) != 0)
 
-#define	ORDER2SIZE(order)	((order) < VMEM_OPTVALUE ? ((order) + 1) : \
-    (vmem_size_t)1 << ((order) - (VMEM_OPTVALUE - VMEM_OPTORDER - 1)))
-#define	SIZE2ORDER(size)	((size) <= VMEM_OPTVALUE ? ((size) - 1) : \
-    (flsl(size) + (VMEM_OPTVALUE - VMEM_OPTORDER - 2)))
+#define	ORDER2SIZE(order)	((order) < VMEM_OPTVALUE ?	\
+	(vmem_size_t)((order) + 1) :				\
+	(vmem_size_t)1 << ((order) - (VMEM_OPTVALUE - VMEM_OPTORDER - 1)))
+#define	SIZE2ORDER(size)	((size) <= VMEM_OPTVALUE ?	\
+	(int)((size) - 1) :					\
+	(flsl(size) + (VMEM_OPTVALUE - VMEM_OPTORDER - 2)))
 
 /*
  * Maximum number of boundary tags that may be required to satisfy an


help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?694405fa.33ba7.3a4b0eaf>