[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix compilation of checked build


  • To: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>, "win-pv-devel@xxxxxxxxxxxxxxxxxxxx" <win-pv-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Owen Smith <owen.smith@xxxxxxxxxx>
  • Date: Mon, 9 Mar 2026 07:48:26 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=FS9Kdhz/nFOgTTZe+v3d0ZzolQ59Yyp8i114HJbVxfY=; b=Cb7G3VxAH38YQlNeCBTCzcK9zSNDFRgurxyHBQ9GlJ/Ehyx34rqwVQQK8xGd2jVgTOlXLGoI1qk7P8EQGK9YcGF0b8w8Lmmc3HRgPm7vomBJkxbmnJERxrp6v5xW0ZfYWBW6Jjlj7Ys+TAXlZVBi859rUTR7IgqmhwxEG/78rQI0D2uVBlkef2o6VtPcW78Phs9UttDlyEwX3B4b6XRdAcGXa+UOdqrwQB61I5QYAGXwj69CnsM4AMDm/NLMd4oQ0Dm/27OInGVu1G1gPgbkdGDNqmdZBZTwf+EH5Tsgc74BZ7lPbFGqQ/e/1Totev6hqrb2LBq9FnTRoeKLJHDysQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Ry6y/SKK6sEpHs52sXBBlMuxQ1BSeZJMEvxpDPHduw7k5KCMvuyBLRuR3bzy5R3MguYak7Cd6qlWLqLSTBbuTF2m41Eg1WWMyQJGVhuH+Jvk6ewnXJ9sVfxQj5cbGYe25Bld0rP19l/dD3Ngr5/uYi706Sp0/kQ2Uu0QNEWVTVI3tEF5Tqh6s9T8Z/Iq2/yD2FN03MWAmEKe7Ky0AnicsSYnidsv0n+Vpw4VgHRI9xAtMApsojdS5xvy8yx7mOr7GTHi6hH2eJDTn4u+RzAYcMgXL0QiCRnxrupCbz/rxFnbCvwPrbG1IIOubbhFmxBlNQaFo4USDqECu95wY8jg8w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Delivery-date: Mon, 09 Mar 2026 07:48:35 +0000
  • List-id: Developer list for the Windows PV Drivers subproject <win-pv-devel.lists.xenproject.org>
  • Msip_labels:
  • Thread-index: AQHcraHgMyhDAwQfPUqY3VZG+GeRz7Wl1YkA
  • Thread-topic: [PATCH] Fix compilation of checked build

I would prefer to keep the BUG() statements, as this logs the issue and is 
present
 in free builds. It would mean assigning Value before the BUG statement to avoid
unreachable code warnings in free builds.

Owen

________________________________________
From: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
Sent: 06 March 2026 7:46 PM
To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
Cc: Tu Dinh; Owen Smith
Subject: [PATCH] Fix compilation of checked build

* Redefine XEN_API to __declspec(dllexport) to avoid declaring LogPrintf
  and similar symbols in the same binary as dllimport.
* The BUG() macro was not correctly identified as noreturn in checked
  builds, causing a warning about uninitialized variables. Use
  ASSERT(FALSE) (which does not signal unreachable code) and set the
  variable's value at the end instead.

Signed-off-by: Tu Dinh <ngoc-tu.dinh@xxxxxxxxxx>
---
 src/xen/hypercall.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/xen/hypercall.c b/src/xen/hypercall.c
index 3c68709..fd7401a 100644
--- a/src/xen/hypercall.c
+++ b/src/xen/hypercall.c
@@ -30,6 +30,9 @@
  * SUCH DAMAGE.
  */

+#undef  XEN_API
+#define XEN_API __declspec(dllexport)
+
 #include <ntddk.h>
 #include <xen.h>
 #include <intrin.h>
@@ -188,7 +191,8 @@ __Hypercall(
             Value = hypercall2_vmmcall(ord, arg1, arg2);
             break;
         default:
-            BUG("NO HYPERCALL INSTRUCTION");
+            ASSERT(FALSE);
+            Value = 0;
         }
         break;
     }
@@ -206,7 +210,8 @@ __Hypercall(
             Value = hypercall3_vmmcall(ord, arg1, arg2, arg3);
             break;
         default:
-            BUG("NO HYPERCALL INSTRUCTION");
+            ASSERT(FALSE);
+            Value = 0;
         }
         break;
     }
--
2.53.0.windows.1



--
 | Vates

XCP-ng & Xen Orchestra - Vates solutions

web: https://vates.tech




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.