|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [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
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |